Class BitwardenConfig

All Implemented Interfaces:
ExtensionPoint, Describable<GlobalConfiguration>, Saveable, Loadable, OnMaster

@Extension @Symbol("bitwarden") public final class BitwardenConfig extends GlobalConfiguration
A Jenkins-managed singleton responsible for managing this plugin.
  • Constructor Details

    • BitwardenConfig

      public BitwardenConfig()
  • Method Details

    • getInstance

      @NonNull public static BitwardenConfig getInstance()
      Returns:
      The singleton instance of this manager.
    • isConfigured

      public boolean isConfigured()
      Returns:
      true if the plugin is configured with an API key and master password credential ID
    • getDisplayName

      @NonNull public String getDisplayName()
      Overrides:
      getDisplayName in class Descriptor<GlobalConfiguration>
    • getServerUrl

      @NonNull public String getServerUrl()
    • setServerUrl

      @DataBoundSetter public void setServerUrl(@CheckForNull String serverUrl)
    • getApiCredentialId

      @CheckForNull public String getApiCredentialId()
    • setApiCredentialId

      @DataBoundSetter public void setApiCredentialId(@CheckForNull String apiCredentialId)
    • getMasterPasswordCredentialId

      @CheckForNull public String getMasterPasswordCredentialId()
    • setMasterPasswordCredentialId

      @DataBoundSetter public void setMasterPasswordCredentialId(@CheckForNull String masterPasswordCredentialId)
    • getFileCredentialSuffixes

      @CheckForNull public String getFileCredentialSuffixes()
    • setFileCredentialSuffixes

      @DataBoundSetter public void setFileCredentialSuffixes(@CheckForNull String fileCredentialSuffixes)
    • hasFileCredentialSuffix

      public boolean hasFileCredentialSuffix(@NonNull String name)
      Returns whether the given item name ends with a user-configured file credential suffix.
      Parameters:
      name - the name of the Bitwarden item
      Returns:
      true if the name ends with a configured suffix
    • getCliExecutablePath

      @CheckForNull public String getCliExecutablePath()
    • setCliExecutablePath

      @DataBoundSetter public void setCliExecutablePath(@CheckForNull String cliExecutablePath)
    • getCacheDuration

      public int getCacheDuration()
    • setCacheDuration

      @DataBoundSetter public void setCacheDuration(int duration)
    • configure

      public boolean configure(@NonNull org.kohsuke.stapler.StaplerRequest2 req, @NonNull net.sf.json.JSONObject json) throws Descriptor.FormException
      Overrides:
      configure in class GlobalConfiguration
      Throws:
      Descriptor.FormException
    • save

      public void save()
      Triggers a background task to re-authenticate and/or resync the credential cache if any critical settings have changed.

      Specified by:
      save in interface Saveable
      Overrides:
      save in class Descriptor<GlobalConfiguration>
    • doFillApiCredentialIdItems

      @POST @NonNull public ListBoxModel doFillApiCredentialIdItems(@NonNull @AncestorInPath Jenkins context, @CheckForNull @QueryParameter String apiCredentialId)
      Populates the Bitwarden API Key Credential dropdown in the UI.
      Parameters:
      context - the current Jenkins context
      apiCredentialId - the ID of the currently selected credential
      Returns:
      a list of suitable credentials
    • doFillMasterPasswordCredentialIdItems

      @POST @NonNull public ListBoxModel doFillMasterPasswordCredentialIdItems(@NonNull @AncestorInPath Jenkins context, @CheckForNull @QueryParameter String masterPasswordCredentialId)
      Populates the Bitwarden Master Password Credential dropdown in the UI.
      Parameters:
      context - the current Jenkins context
      masterPasswordCredentialId - the ID of the currently selected credential
      Returns:
      a list of suitable credentials
    • doSyncVault

      @POST @NonNull public FormValidation doSyncVault()
      An action for the "Sync Vault" button in the UI.
      Returns:
      a form validation indicating the action was attempted
    • doCheckCliVersion

      @POST @NonNull public FormValidation doCheckCliVersion()
      An action for the "Check Version" button in the UI.
      Returns:
      a form validation showing the installed Bitwarden CLI version or an error
    • doUpdateCli

      @POST @NonNull public FormValidation doUpdateCli()
      An action for the "Update CLI" button in the UI.
      Returns:
      a form validation indicating the result of the download/update attempt
    • doVerifySession

      @POST @NonNull public FormValidation doVerifySession()
      An action for the "Verify Session" button in the UI.
      Returns:
      a form validation indicating whether the plugin has an active Bitwarden CLI session