Class BitwardenCredentialsProvider

java.lang.Object
hudson.model.Descriptor<com.cloudbees.plugins.credentials.CredentialsProvider>
com.cloudbees.plugins.credentials.CredentialsProvider
com.mwdle.bitwarden.BitwardenCredentialsProvider
All Implemented Interfaces:
ExtensionPoint, Describable<com.cloudbees.plugins.credentials.CredentialsProvider>, Saveable, Loadable, OnMaster, IconSpec

@Extension public class BitwardenCredentialsProvider extends com.cloudbees.plugins.credentials.CredentialsProvider
The main entry point for the plugin, responsible for providing Bitwarden-backed credentials to Jenkins.

This class is a singleton managed by Jenkins. Its primary role is to respond to requests for credentials (from pipelines or the UI) by fetching metadata from the BitwardenCacheManager and converting it into a list of lazy-loading CredentialProxy objects.

  • Constructor Details

    • BitwardenCredentialsProvider

      public BitwardenCredentialsProvider()
  • Method Details

    • getInstance

      public static BitwardenCredentialsProvider getInstance()
      Provides global access to the single instance of this provider.
      Returns:
      The singleton instance of this provider.
    • getStore

      public com.cloudbees.plugins.credentials.CredentialsStore getStore(ModelObject object)
      Provides the BitwardenCredentialsStore to the Jenkins UI for the global credentials context.
      Overrides:
      getStore in class com.cloudbees.plugins.credentials.CredentialsProvider
      Parameters:
      object - The context for which the store is being requested.
      Returns:
      The singleton BitwardenCredentialsStore if the context is the Jenkins root, otherwise null.
    • listCredentials

      public List<com.cloudbees.plugins.credentials.Credentials> listCredentials()
      The primary method for generating the list of all available Bitwarden credentials.

      This method is safe for all consumers (UI and pipelines). It fetches the latest metadata from the cache, intelligently assigns a Jenkins ID (using the name for unique items and the UUID for items with duplicate names), and returns a list of credential proxies.

      It will not block or throw exceptions if the cache is being refreshed or has failed to load, and will instead return an empty list.

      Returns:
      A list of all available Credentials proxies from Bitwarden.
    • getCredentialsInItemGroup

      @Nonnull public <C extends com.cloudbees.plugins.credentials.Credentials> List<C> getCredentialsInItemGroup(@Nonnull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable org.springframework.security.core.Authentication authentication, @Nonnull List<com.cloudbees.plugins.credentials.domains.DomainRequirement> domainRequirements)
      Called by Jenkins to get a list of credentials that are available in a given context.

      This implementation delegates to listCredentials() to get all available proxies and then filters that list to return only the credentials of the requested type.

      Overrides:
      getCredentialsInItemGroup in class com.cloudbees.plugins.credentials.CredentialsProvider
      Parameters:
      type - The class of credentials being requested.
      itemGroup - The context in which the credentials are being requested.
      authentication - The authentication context of the user or process.
      domainRequirements - Any domain requirements for the credentials.
      Returns:
      A list of dynamically-generated credentials matching the request.
    • getIconClassName

      public String getIconClassName()
      Provides the CSS class name for the SVG symbol used as this provider's icon. The corresponding SVG file is located in src/main/resources/images/symbols/.
      Specified by:
      getIconClassName in interface IconSpec
      Overrides:
      getIconClassName in class com.cloudbees.plugins.credentials.CredentialsProvider
      Returns:
      The CSS class name for the icon.