Class CredentialsProvider
- All Implemented Interfaces:
ExtensionPoint,Describable<CredentialsProvider>,Saveable,Loadable,OnMaster,IconSpec
- Direct Known Subclasses:
SystemCredentialsProvider.ProviderImpl,UserCredentialsProvider
public abstract class CredentialsProvider
extends Descriptor<CredentialsProvider>
implements ExtensionPoint, Describable<CredentialsProvider>, IconSpec
An extension point for providing
Credentials.-
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
FieldsModifier and TypeFieldDescriptionstatic final PermissionThe permission for adding credentials to aCredentialsStore.static final PermissionThe permission for removing credentials from aCredentialsStore.static final PermissionGroupThe permission group for credentials.static final PermissionThe permission for managing credential domains in aCredentialsStore.static final CredentialsProviderACredentialsProviderthat does nothing for use as a markerstatic final PermissionThe permission for updating credentials in aCredentialsStore.static final PermissionWhere an immediate action against a job requires that a credential be selected by the user triggering the action, this permission allows the user to select a credential from those credentials available within the scope of the job.static final PermissionWhere an immediate action against a job requires that a credential be selected by the user triggering the action, this permission allows the user to select a credential from their private credential store.static final PermissionThe permission for viewing credentials in aCredentialsStore.Fields inherited from class hudson.model.Descriptor
clazz -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean_isApplicable(Descriptor<?> descriptor) CredentialsProvidersubtypes can override this method to veto someDescriptors from being available from their store.static ExtensionList<CredentialsProvider>all()Returns the list of allCredentialsProvider.Returns all the registeredCredentialsdescriptors.static List<CredentialsProvider>enabled()Returns only thoseCredentialsProviderthat areisEnabled().static List<CredentialsProvider>Returns only thoseCredentialsProviderthat areisEnabled()within a specific context.static <C extends IdCredentials>
CfindCredentialById(String id, Class<C> type, Run<?, ?> run) A common requirement for plugins is to resolve a specific credential by id in the context of a specific run.static <C extends IdCredentials>
CfindCredentialById(String id, Class<C> type, Run<?, ?> run, DomainRequirement... domainRequirements) Deprecated.static <C extends IdCredentials>
CfindCredentialById(String id, Class<C> type, Run<?, ?> run, List<DomainRequirement> domainRequirements) A common requirement for plugins is to resolve a specific credential by id in the context of a specific run.<C extends IdCredentials>
ListBoxModelgetCredentialIds(Class<C> type, ItemGroup itemGroup, Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Deprecated.<C extends IdCredentials>
ListBoxModelgetCredentialIds(Class<C> type, Item item, Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Deprecated.<C extends IdCredentials>
ListBoxModelgetCredentialIdsInItem(Class<C> type, Item item, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Returns aListBoxModelof the credentials provided by this provider which are available to the specifiedAuthenticationfor the specifiedItemand are appropriate for the specifiedDomainRequirements.<C extends IdCredentials>
ListBoxModelgetCredentialIdsInItemGroup(Class<C> type, ItemGroup itemGroup, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Returns aListBoxModelof the credentials provided by this provider which are available to the specifiedAuthenticationfor items in the specifiedItemGroupand are appropriate for the specifiedDomainRequirements.<C extends Credentials>
List<C>getCredentials(Class<C> type, ItemGroup itemGroup, Authentication authentication) Deprecated.<C extends Credentials>
List<C>getCredentials(Class<C> type, ItemGroup itemGroup, Authentication authentication, List<DomainRequirement> domainRequirements) Deprecated.<C extends Credentials>
List<C>getCredentials(Class<C> type, Item item, Authentication authentication) Deprecated.<C extends Credentials>
List<C>getCredentials(Class<C> type, Item item, Authentication authentication, List<DomainRequirement> domainRequirements) Deprecated.final List<CredentialsDescriptor>Returns the list ofCredentialsDescriptorinstances that are applicable within thisCredentialsProvider.<C extends Credentials>
List<C>getCredentialsInItem(Class<C> type, Item item, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements) Returns the credentials provided by this provider which are available to the specifiedAuthenticationfor the specifiedItemand are appropriate for the specifiedDomainRequirements.<C extends Credentials>
List<C>getCredentialsInItemGroup(Class<C> type, ItemGroup itemGroup, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements) Returns the credentials provided by this provider which are available to the specifiedAuthenticationfor items in the specifiedItemGroupand are appropriate for the specified.plugins.credentials.domains.DomainRequirements.static FingerprintRetrieves theFingerprintfor a specific credential.static FingerprintCreates a fingerprint that can be used to track the usage of a specific credential.getScopes(ModelObject object) Returns the scopes allowed for credentials stored within the specified object ornullif the object is not relevant for scopes and the object's container should be considered instead.getStore(ModelObject object) Returns theCredentialsStorethat thisCredentialsProvidermaintains specifically for thisModelObjectornullif either the object is not a credentials container or thisCredentialsProviderdoes not maintain a store specifically bound to thisModelObject.final booleanChecks if there is at least oneCredentialsDescriptorapplicable within thisCredentialsProvider.static booleanhasStores(ModelObject context) Tests if the supplied context has any credentials stores associated with it.final booleanisApplicable(Descriptor<?> descriptor) final booleanisApplicable(Class<? extends Credentials> clazz) Returnstrueif thisCredentialsProvidercan provide credentials of the supplied type.final booleanReturnstrueif thisCredentialsProvideris enabled.booleanReturnstrueif thisCredentialsProvideris enabled in the specified context.static <C extends IdCredentials>
ListBoxModellistCredentials(Class<C> type, ItemGroup itemGroup, Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Deprecated.static <C extends IdCredentials>
ListBoxModellistCredentials(Class<C> type, Item item, Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Deprecated.static <C extends IdCredentials>
ListBoxModellistCredentialsInItem(Class<C> type, Item item, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Returns aListBoxModelof all credentials which are available to the specifiedAuthenticationfor use by the specifiedItem.static <C extends IdCredentials>
ListBoxModellistCredentialsInItemGroup(Class<C> type, ItemGroup itemGroup, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements, CredentialsMatcher matcher) Returns aListBoxModelof all credentials which are available to the specifiedAuthenticationfor use by theItems in the specifiedItemGroup.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type) static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, Item item) Deprecated.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, ItemGroup itemGroup) Deprecated.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, ItemGroup itemGroup, Authentication authentication) Deprecated.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, ItemGroup itemGroup, Authentication authentication, DomainRequirement... domainRequirements) static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, ItemGroup itemGroup, Authentication authentication, List<DomainRequirement> domainRequirements) Deprecated.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, Item item, Authentication authentication) Deprecated.uselookupCredentialsInItem(Class, Item, Authentication)instead.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, Item item, Authentication authentication, DomainRequirement... domainRequirements) static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, Item item, Authentication authentication, List<DomainRequirement> domainRequirements) Deprecated.static <C extends Credentials>
List<C>lookupCredentials(Class<C> type, Authentication authentication) static <C extends Credentials>
List<C>lookupCredentialsInItem(Class<C> type, Item item, org.springframework.security.core.Authentication authentication) Returns all credentials which are available to the specifiedAuthenticationfor use by the specifiedItem.static <C extends Credentials>
List<C>lookupCredentialsInItem(Class<C> type, Item item, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements) Returns all credentials which are available to the specifiedAuthenticationfor use by the specifiedItem.static <C extends Credentials>
List<C>lookupCredentialsInItemGroup(Class<C> type, ItemGroup itemGroup, org.springframework.security.core.Authentication authentication) static <C extends Credentials>
List<C>lookupCredentialsInItemGroup(Class<C> type, ItemGroup itemGroup, org.springframework.security.core.Authentication authentication, List<DomainRequirement> domainRequirements) static Set<CredentialsScope>lookupScopes(ModelObject object) Returns the scopes allowed for credentials stored within the specified object ornullif the object is not relevant for scopes and the object's container should be considered instead.static Iterable<CredentialsStore>lookupStores(ModelObject context) Returns a lazyIterableof all theCredentialsStoreinstances contributing credentials to the supplied object.static voidsaveAll()A helper method for Groovy Scripting to address use cases such as JENKINS-39317 where all credential stores need to be resaved.static <C extends Credentials>
Csnapshot(C credential) Make a best effort to ensure that the supplied credential is a snapshot credential (i.e.static <C extends Credentials>
CMake a best effort to ensure that the supplied credential is a snapshot credential (i.e.static <C extends Credentials>
CTrack the usage of credentials in a specific item but not associated with a specific build, for example SCM polling.static <C extends Credentials>
CTrack the usage of credentials in a specific node.static <C extends Credentials>
CTrack the usage of credentials in a specific build.static <C extends Credentials>
List<C>Track the usage of credentials in a specific item but not associated with a specific build, for example SCM polling.static <C extends Credentials>
List<C>Track the usage of credentials in a specific item but not associated with a specific build, for example SCM polling.static <C extends Credentials>
List<C>Track the usage of credentials in a specific node.static <C extends Credentials>
List<C>Track the usage of credentials in a specific node.static <C extends Credentials>
List<C>Track the usage of credentials in a specific build.static <C extends Credentials>
List<C>Track the usage of credentials in a specific build.Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, configure, configure, doHelp, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, 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, save, self, toArray, toList, toMap
-
Field Details
-
NONE
ACredentialsProviderthat does nothing for use as a marker- Since:
- 2.1.1
-
GROUP
The permission group for credentials.- Since:
- 1.8
-
USE_OWN
Where an immediate action against a job requires that a credential be selected by the user triggering the action, this permission allows the user to select a credential from their private credential store. Immediate actions could include: building with parameters, tagging a build, deploying artifacts, etc.- Since:
- 1.16
-
USE_ITEM
Where an immediate action against a job requires that a credential be selected by the user triggering the action, this permission allows the user to select a credential from those credentials available within the scope of the job. Immediate actions could include: building with parameters, tagging a build, deploying artifacts, etc. This permission is implied byItem.CONFIGUREas anyone who can configure the job can configure the job to use credentials within the item scope anyway.- Since:
- 1.16
-
CREATE
The permission for adding credentials to aCredentialsStore.- Since:
- 1.8
-
UPDATE
The permission for updating credentials in aCredentialsStore.- Since:
- 1.8
-
VIEW
The permission for viewing credentials in aCredentialsStore.- Since:
- 1.8
-
DELETE
The permission for removing credentials from aCredentialsStore.- Since:
- 1.8
-
MANAGE_DOMAINS
The permission for managing credential domains in aCredentialsStore.- Since:
- 1.8
-
-
Constructor Details
-
CredentialsProvider
public CredentialsProvider()Default constructor.
-
-
Method Details
-
allCredentialsDescriptors
public static DescriptorExtensionList<Credentials,CredentialsDescriptor> allCredentialsDescriptors()Returns all the registeredCredentialsdescriptors.- Returns:
- all the registered
Credentialsdescriptors.
-
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type) -
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable Authentication authentication) -
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable Item item) Deprecated. -
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup) Deprecated. -
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication) Deprecated. -
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable Item item, @Nullable Authentication authentication) Deprecated.uselookupCredentialsInItem(Class, Item, Authentication)instead. -
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication, @Nullable DomainRequirement... domainRequirements) -
lookupCredentialsInItemGroup
@NonNull public static <C extends Credentials> List<C> lookupCredentialsInItemGroup(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable org.springframework.security.core.Authentication authentication) Returns all credentials which are available to the specifiedAuthenticationfor use by theItems in the specifiedItemGroup.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to get.itemGroup- the item group.authentication- the authentication.- Returns:
- the list of credentials.
- Since:
- TODO
-
lookupCredentials
@NonNull @Deprecated public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication, @Nullable List<DomainRequirement> domainRequirements) Deprecated. -
lookupCredentialsInItemGroup
@NonNull public static <C extends Credentials> List<C> lookupCredentialsInItemGroup(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable org.springframework.security.core.Authentication authentication, @Nullable List<DomainRequirement> domainRequirements) Returns all credentials which are available to the specifiedAuthenticationfor use by theItems in the specifiedItemGroup.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to get.itemGroup- the item group.authentication- the authentication.domainRequirements- the credential domains to match.- Returns:
- the list of credentials.
- Since:
- TODO
-
listCredentials
@Deprecated public static <C extends IdCredentials> ListBoxModel listCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication, @Nullable List<DomainRequirement> domainRequirements, @Nullable CredentialsMatcher matcher) Deprecated. -
listCredentialsInItemGroup
public static <C extends IdCredentials> ListBoxModel listCredentialsInItemGroup(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable org.springframework.security.core.Authentication authentication, @Nullable List<DomainRequirement> domainRequirements, @Nullable CredentialsMatcher matcher) Returns aListBoxModelof all credentials which are available to the specifiedAuthenticationfor use by theItems in the specifiedItemGroup.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to get.authentication- the authentication.itemGroup- the item group.domainRequirements- the credential domains to match.matcher- the additional filtering to apply to the credentials- Returns:
- the
ListBoxModelofIdCredentials.getId()with the corresponding display names as provided byCredentialsNameProvider. - Since:
- TODO
-
lookupCredentials
@Deprecated @NonNull public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable Item item, @Nullable Authentication authentication, DomainRequirement... domainRequirements) -
lookupCredentialsInItem
@NonNull public static <C extends Credentials> List<C> lookupCredentialsInItem(@NonNull Class<C> type, @Nullable Item item, @Nullable org.springframework.security.core.Authentication authentication) Returns all credentials which are available to the specifiedAuthenticationfor use by the specifiedItem.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to get.authentication- the authentication.item- the item.- Returns:
- the list of credentials.
- Since:
- TODO
-
lookupCredentials
@NonNull @Deprecated public static <C extends Credentials> List<C> lookupCredentials(@NonNull Class<C> type, @Nullable Item item, @Nullable Authentication authentication, @Nullable List<DomainRequirement> domainRequirements) Deprecated. -
lookupCredentialsInItem
@NonNull public static <C extends Credentials> List<C> lookupCredentialsInItem(@NonNull Class<C> type, @Nullable Item item, @Nullable org.springframework.security.core.Authentication authentication, @Nullable List<DomainRequirement> domainRequirements) Returns all credentials which are available to the specifiedAuthenticationfor use by the specifiedItem.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to get.authentication- the authentication.item- the item.domainRequirements- the credential domains to match.- Returns:
- the list of credentials.
- Since:
- TODO
-
listCredentials
@NonNull @Deprecated public static <C extends IdCredentials> ListBoxModel listCredentials(@NonNull Class<C> type, @Nullable Item item, @Nullable Authentication authentication, @Nullable List<DomainRequirement> domainRequirements, @Nullable CredentialsMatcher matcher) Deprecated. -
listCredentialsInItem
@NonNull public static <C extends IdCredentials> ListBoxModel listCredentialsInItem(@NonNull Class<C> type, @Nullable Item item, @Nullable org.springframework.security.core.Authentication authentication, @Nullable List<DomainRequirement> domainRequirements, @Nullable CredentialsMatcher matcher) Returns aListBoxModelof all credentials which are available to the specifiedAuthenticationfor use by the specifiedItem.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to get.authentication- the authentication.item- the item.domainRequirements- the credential domains to match.matcher- the additional filtering to apply to the credentials- Returns:
- the
ListBoxModelofIdCredentials.getId()with the corresponding display names as provided byCredentialsNameProvider. - Since:
- TODO
-
lookupScopes
Returns the scopes allowed for credentials stored within the specified object ornullif the object is not relevant for scopes and the object's container should be considered instead.- Parameters:
object- the object.- Returns:
- the set of scopes that are relevant for the object or
nullif the object is not a credentials container.
-
hasStores
Tests if the supplied context has any credentials stores associated with it.- Parameters:
context- the context object.- Returns:
trueif and only if the supplied context has at least oneCredentialsStoreassociated with it.- Since:
- 2.1.5
-
lookupStores
Returns a lazyIterableof all theCredentialsStoreinstances contributing credentials to the supplied object.- Parameters:
context- theItemorItemGrouporUserto get theCredentialsStores of.- Returns:
- a lazy
Iterableof allCredentialsStoreinstances. - Since:
- 1.8
-
snapshot
Make a best effort to ensure that the supplied credential is a snapshot credential (i.e. self-contained and does not reference any external stores). WARNING: May produce unusual results if presented an exotic credential that implements multiple distinct credential types at the same time, e.g. a credential that is simultaneously a TLS certificate and a SSH key pair and a GPG key pair all at the same time... unless the author of that credential type also provides aCredentialsSnapshotTakerthat can handle such a triple play.- Type Parameters:
C- the type of credential.- Parameters:
credential- the credential.- Returns:
- the credential or a snapshot of the credential.
- Since:
- 1.14
-
snapshot
Make a best effort to ensure that the supplied credential is a snapshot credential (i.e. self-contained and does not reference any external stores)- Type Parameters:
C- the type of credential.- Parameters:
clazz- the type of credential that we are trying to snapshot (specified so that if there is more than one type of snapshot able credential interface implemented by the credentials, then they can be separated out.credential- the credential.- Returns:
- the credential or a snapshot of the credential.
- Since:
- 1.14
-
findCredentialById
@CheckForNull public static <C extends IdCredentials> C findCredentialById(@NonNull String id, @NonNull Class<C> type, @NonNull Run<?, ?> run) A common requirement for plugins is to resolve a specific credential by id in the context of a specific run. Given that the credential itself could be resulting from a build parameter expression and the complexities of determining the scope of items from which the credential should be resolved in a chain of builds, this method provides the correct answer.- Type Parameters:
C- the credentials type.- Parameters:
id- either the id of the credential to find or a parameter expression for the id.type- the type of credential to find.run- theRundefining the context within which to find the credential.- Returns:
- the credential or
nullif either the credential cannot be found or the user triggering the run is not permitted to use the credential in the context of the run. - Since:
- TODO
-
findCredentialById
public static <C extends IdCredentials> C findCredentialById(@NonNull String id, @NonNull Class<C> type, @NonNull Run<?, ?> run, DomainRequirement... domainRequirements) Deprecated.UsefindCredentialById(String, Class, Run, List)instead. -
findCredentialById
@CheckForNull public static <C extends IdCredentials> C findCredentialById(@NonNull String id, @NonNull Class<C> type, @NonNull Run<?, ?> run, @Nullable List<DomainRequirement> domainRequirements) A common requirement for plugins is to resolve a specific credential by id in the context of a specific run. Given that the credential itself could be resulting from a build parameter expression and the complexities of determining the scope of items from which the credential should be resolved in a chain of builds, this method provides the correct answer.- Type Parameters:
C- the credentials type.- Parameters:
id- either the id of the credential to find or a parameter expression for the id.type- the type of credential to find.run- theRundefining the context within which to find the credential.domainRequirements- the domain requirements of the credential.- Returns:
- the credential or
nullif either the credential cannot be found or the user triggering the run is not permitted to use the credential in the context of the run. - Since:
- 1.16
-
all
Returns the list of allCredentialsProvider.- Returns:
- the list of all
CredentialsProvider.
-
enabled
Returns only thoseCredentialsProviderthat areisEnabled().- Returns:
- a list of
CredentialsProviderthat areisEnabled(). - Since:
- 2.0
-
enabled
Returns only thoseCredentialsProviderthat areisEnabled()within a specific context.- Parameters:
context- the context in which to get the list.- Returns:
- a list of
CredentialsProviderthat areisEnabled(). - Since:
- 2.0
-
getDescriptor
- Specified by:
getDescriptorin interfaceDescribable<CredentialsProvider>
-
isEnabled
public final boolean isEnabled()Returnstrueif thisCredentialsProvideris enabled.- Returns:
trueif thisCredentialsProvideris enabled.- Since:
- 2.0
-
isEnabled
Returnstrueif thisCredentialsProvideris enabled in the specified context.- Parameters:
context- the context.- Returns:
trueif thisCredentialsProvideris enabled in the specified context.- Since:
- 2.0
-
getDisplayName
- Overrides:
getDisplayNamein classDescriptor<CredentialsProvider>
-
getIconClassName
- Specified by:
getIconClassNamein interfaceIconSpec
-
getScopes
Returns the scopes allowed for credentials stored within the specified object ornullif the object is not relevant for scopes and the object's container should be considered instead.- Parameters:
object- the object.- Returns:
- the set of scopes that are relevant for the object or
nullif the object is not a credentials container.
-
getStore
Returns theCredentialsStorethat thisCredentialsProvidermaintains specifically for thisModelObjectornullif either the object is not a credentials container or thisCredentialsProviderdoes not maintain a store specifically bound to thisModelObject.- Parameters:
object- theItemorItemGrouporUserthat the store is being requested of.- Returns:
- either
nullor a scopedCredentialsStorewhereCredentialsStore.getContext()== object. - Since:
- 1.8
-
getCredentials
@NonNull @Deprecated public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication) Deprecated. -
getCredentials
@Deprecated @NonNull public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication, @NonNull List<DomainRequirement> domainRequirements) Deprecated. -
getCredentialsInItemGroup
@NonNull public <C extends Credentials> List<C> getCredentialsInItemGroup(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable org.springframework.security.core.Authentication authentication, @NonNull List<DomainRequirement> domainRequirements) Returns the credentials provided by this provider which are available to the specifiedAuthenticationfor items in the specifiedItemGroupand are appropriate for the specified.plugins.credentials.domains.DomainRequirements.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to return.itemGroup- the item group (ifnullassumeJenkins.get().authentication- the authentication (ifnullassumeACL.SYSTEM2.domainRequirements- the credential domains to match (if theCredentialsProviderdoes not supportDomainRequirements then it should assume the match is true).- Returns:
- the list of credentials.
- Since:
- TODO
-
getCredentialIds
@NonNull @Deprecated public <C extends IdCredentials> ListBoxModel getCredentialIds(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable Authentication authentication, @NonNull List<DomainRequirement> domainRequirements, @NonNull CredentialsMatcher matcher) Deprecated. -
getCredentialIdsInItemGroup
@NonNull public <C extends IdCredentials> ListBoxModel getCredentialIdsInItemGroup(@NonNull Class<C> type, @Nullable ItemGroup itemGroup, @Nullable org.springframework.security.core.Authentication authentication, @NonNull List<DomainRequirement> domainRequirements, @NonNull CredentialsMatcher matcher) Returns aListBoxModelof the credentials provided by this provider which are available to the specifiedAuthenticationfor items in the specifiedItemGroupand are appropriate for the specifiedDomainRequirements. NOTE: implementations are recommended to override this method if the actual secret information is being stored external from Jenkins and the non-secret information can be accessed with lesser traceability requirements. The default implementation just usesgetCredentialsInItem(Class, Item, Authentication, List)to build theListBoxModel. Handling theCredentialsMatchermay require standing up a proxy instance to apply the matcher against ifCredentialsMatchers.describe(CredentialsMatcher)returnsnull- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to return.itemGroup- the item group (ifnullassumeJenkins.get().authentication- the authentication (ifnullassumeACL.SYSTEM2.domainRequirements- the credential domain to match.matcher- the additional filtering to apply to the credentials- Returns:
- the
ListBoxModelofIdCredentials.getId()with names provided byCredentialsNameProvider. - Since:
- TODO
-
getCredentials
@Deprecated @NonNull public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type, @NonNull Item item, @Nullable Authentication authentication) Deprecated. -
getCredentials
@Deprecated @NonNull public <C extends Credentials> List<C> getCredentials(@NonNull Class<C> type, @NonNull Item item, @Nullable Authentication authentication, @NonNull List<DomainRequirement> domainRequirements) Deprecated. -
getCredentialsInItem
@NonNull public <C extends Credentials> List<C> getCredentialsInItem(@NonNull Class<C> type, @NonNull Item item, @Nullable org.springframework.security.core.Authentication authentication, @NonNull List<DomainRequirement> domainRequirements) Returns the credentials provided by this provider which are available to the specifiedAuthenticationfor the specifiedItemand are appropriate for the specifiedDomainRequirements.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to return.item- the item.authentication- the authentication (ifnullassumeACL.SYSTEM2.domainRequirements- the credential domain to match.- Returns:
- the list of credentials.
- Since:
- TODO
-
getCredentialIds
@NonNull @Deprecated public <C extends IdCredentials> ListBoxModel getCredentialIds(@NonNull Class<C> type, @NonNull Item item, @Nullable Authentication authentication, @NonNull List<DomainRequirement> domainRequirements, @NonNull CredentialsMatcher matcher) Deprecated. -
getCredentialIdsInItem
@NonNull public <C extends IdCredentials> ListBoxModel getCredentialIdsInItem(@NonNull Class<C> type, @NonNull Item item, @Nullable org.springframework.security.core.Authentication authentication, @NonNull List<DomainRequirement> domainRequirements, @NonNull CredentialsMatcher matcher) Returns aListBoxModelof the credentials provided by this provider which are available to the specifiedAuthenticationfor the specifiedItemand are appropriate for the specifiedDomainRequirements. NOTE: implementations are recommended to override this method if the actual secret information is being stored external from Jenkins and the non-secret information can be accessed with lesser traceability requirements. The default implementation just usesgetCredentialsInItem(Class, Item, Authentication, List)to build theListBoxModel. Handling theCredentialsMatchermay require standing up a proxy instance to apply the matcher against.- Type Parameters:
C- the credentials type.- Parameters:
type- the type of credentials to return.item- the item.authentication- the authentication (ifnullassumeACL.SYSTEM2.domainRequirements- the credential domain to match.matcher- the additional filtering to apply to the credentials- Returns:
- the
ListBoxModelofIdCredentials.getId()with names provided byCredentialsNameProvider. - Since:
- TODO
-
isApplicable
Returnstrueif thisCredentialsProvidercan provide credentials of the supplied type.- Parameters:
clazz- the base type ofCredentialsto check.- Returns:
trueif and only if there is at least oneCredentialsDescriptormatching the requiredCredentialsinterface thatisApplicable(Descriptor).- Since:
- 2.0
-
isApplicable
- Parameters:
descriptor- theDescriptorto check.- Returns:
trueif and only if the suppliedDescriptoris applicable in thisCredentialsProvider.- Since:
- 2.0
-
_isApplicable
CredentialsProvidersubtypes can override this method to veto someDescriptors from being available from their store. This is often useful when you are building a custom store that holds a specific type of credentials or where you want to limit the number of choices given to the users.- Parameters:
descriptor- theDescriptorto check.- Returns:
trueif the suppliedDescriptoris applicable in thisCredentialsProvider- Since:
- 2.0
-
getCredentialsDescriptors
Returns the list ofCredentialsDescriptorinstances that are applicable within thisCredentialsProvider.- Returns:
- the list of
CredentialsDescriptorinstances that are applicable within thisCredentialsProvider. - Since:
- 2.0
-
hasCredentialsDescriptors
public final boolean hasCredentialsDescriptors()Checks if there is at least oneCredentialsDescriptorapplicable within thisCredentialsProvider.- Returns:
trueif and ony if there is at least oneCredentialsDescriptorapplicable within thisCredentialsProvider.- Since:
- 2.0
-
getFingerprintOf
Retrieves theFingerprintfor a specific credential.- Parameters:
c- the credential.- Returns:
- the
Fingerprintornullif the credential has no fingerprint associated with it. - Throws:
IOException- if the credential's fingerprint hash could not be computed.- Since:
- 2.1.1
-
getOrCreateFingerprintOf
@NonNull public static Fingerprint getOrCreateFingerprintOf(@NonNull Credentials c) throws IOException Creates a fingerprint that can be used to track the usage of a specific credential.- Parameters:
c- the credential to fingerprint.- Returns:
- the Fingerprint.
- Throws:
IOException- if the credential's fingerprint hash could not be computed.- Since:
- 2.1.1
-
track
@CheckForNull public static <C extends Credentials> C track(@NonNull Run build, @CheckForNull C credentials) Track the usage of credentials in a specific build.- Type Parameters:
C- the credentials type.- Parameters:
build- the run to tag the fingerprintcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
trackAll
@SafeVarargs @NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Run build, C... credentials) Track the usage of credentials in a specific build.- Type Parameters:
C- the credentials type.- Parameters:
build- the run to tag the fingerprintcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
trackAll
@NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Run build, @NonNull List<C> credentials) Track the usage of credentials in a specific build.- Type Parameters:
C- the credentials type.- Parameters:
build- the run to tag the fingerprintcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
track
@CheckForNull public static <C extends Credentials> C track(@NonNull Node node, @CheckForNull C credentials) Track the usage of credentials in a specific node. Would be used for example when launching an agent.- Type Parameters:
C- the credentials type.- Parameters:
node- the node to tag the fingerprintcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
trackAll
@SafeVarargs @NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Node node, C... credentials) Track the usage of credentials in a specific node. Would be used for example when launching an agent.- Type Parameters:
C- the credentials type.- Parameters:
node- the node to tag the fingerprintcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
trackAll
@NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Node node, @NonNull List<C> credentials) Track the usage of credentials in a specific node. Would be used for example when launching an agent.- Type Parameters:
C- the credentials type.- Parameters:
node- the node to tag the fingerprintcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
track
@CheckForNull public static <C extends Credentials> C track(@NonNull Item item, @CheckForNull C credentials) Track the usage of credentials in a specific item but not associated with a specific build, for example SCM polling.- Type Parameters:
C- the credentials type.- Parameters:
item- the item to tag the fingerprint againstcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
trackAll
@SafeVarargs @NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Item item, C... credentials) Track the usage of credentials in a specific item but not associated with a specific build, for example SCM polling.- Type Parameters:
C- the credentials type.- Parameters:
item- the item to tag the fingerprint againstcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
trackAll
@NonNull public static <C extends Credentials> List<C> trackAll(@NonNull Item item, @NonNull List<C> credentials) Track the usage of credentials in a specific item but not associated with a specific build, for example SCM polling.- Type Parameters:
C- the credentials type.- Parameters:
item- the item to tag the fingerprint againstcredentials- the credentials to fingerprint.- Returns:
- the supplied credentials for method chaining.
- Since:
- 2.1.1
-
saveAll
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public static void saveAll()A helper method for Groovy Scripting to address use cases such as JENKINS-39317 where all credential stores need to be resaved. As this is a potentially very expensive operation the method has been markedDoNotUsein order to ensure that no plugin attempts to call this method. If invoking this method from aninit.dGroovy script, ensure that the call is guarded by a marker file such that
-
findCredentialById(String, Class, Run, List)instead.