Package com.mwdle.bitwarden
Class BitwardenConfig
java.lang.Object
hudson.model.Descriptor<GlobalConfiguration>
jenkins.model.GlobalConfiguration
com.mwdle.bitwarden.BitwardenConfig
- All Implemented Interfaces:
ExtensionPoint,Describable<GlobalConfiguration>,Saveable,Loadable,OnMaster
A Jenkins-managed singleton responsible for managing this plugin.
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.SelfNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Field Summary
Fields inherited from class hudson.model.Descriptor
clazz -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanconfigure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject json) An action for the "Check Version" button in the UI.doFillApiCredentialIdItems(Jenkins context, String apiCredentialId) Populates the Bitwarden API Key Credential dropdown in the UI.doFillMasterPasswordCredentialIdItems(Jenkins context, String masterPasswordCredentialId) Populates the Bitwarden Master Password Credential dropdown in the UI.An action for the "Sync Vault" button in the UI.An action for the "Update CLI" button in the UI.An action for the "Verify Session" button in the UI.intstatic BitwardenConfigbooleanReturns whether the given item name ends with a user-configured file credential suffix.booleanvoidsave()Triggers a background task to re-authenticate and/or resync the credential cache if any critical settings have changed.voidsetApiCredentialId(String apiCredentialId) voidsetCacheDuration(int duration) voidsetCliExecutablePath(String cliExecutablePath) voidsetFileCredentialSuffixes(String fileCredentialSuffixes) voidsetMasterPasswordCredentialId(String masterPasswordCredentialId) voidsetServerUrl(String serverUrl) Methods inherited from class jenkins.model.GlobalConfiguration
all, configure, getDescriptor, getGlobalConfigPageMethods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, doHelp, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getStaticHelpUrl, getStaticHelpUrl, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, self, toArray, toList, toMap
-
Constructor Details
-
BitwardenConfig
public BitwardenConfig()
-
-
Method Details
-
getInstance
- Returns:
- The singleton instance of this manager.
-
isConfigured
public boolean isConfigured()- Returns:
trueif the plugin is configured with an API key and master password credential ID
-
getDisplayName
- Overrides:
getDisplayNamein classDescriptor<GlobalConfiguration>
-
getServerUrl
-
setServerUrl
-
getApiCredentialId
-
setApiCredentialId
-
getMasterPasswordCredentialId
-
setMasterPasswordCredentialId
@DataBoundSetter public void setMasterPasswordCredentialId(@CheckForNull String masterPasswordCredentialId) -
getFileCredentialSuffixes
-
setFileCredentialSuffixes
-
hasFileCredentialSuffix
Returns whether the given item name ends with a user-configured file credential suffix.- Parameters:
name- the name of the Bitwarden item- Returns:
trueif the name ends with a configured suffix
-
getCliExecutablePath
-
setCliExecutablePath
-
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:
configurein classGlobalConfiguration- 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:
savein interfaceSaveable- Overrides:
savein classDescriptor<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 contextapiCredentialId- 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 contextmasterPasswordCredentialId- the ID of the currently selected credential- Returns:
- a list of suitable credentials
-
doSyncVault
An action for the "Sync Vault" button in the UI.- Returns:
- a form validation indicating the action was attempted
-
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
An action for the "Update CLI" button in the UI.- Returns:
- a form validation indicating the result of the download/update attempt
-
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
-