Class UserCredentialsProvider.StoreImpl
java.lang.Object
com.cloudbees.plugins.credentials.CredentialsStore
com.cloudbees.plugins.credentials.UserCredentialsProvider.StoreImpl
- All Implemented Interfaces:
Saveable,AccessControlled
- Enclosing class:
UserCredentialsProvider
Our implementation
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaddCredentials(Domain domain, Credentials credentials) booleanaddDomain(Domain domain, List<Credentials> credentials) Adds a newDomainwith seed credentials.getACL()Returns the context within which this store operates.getCredentials(Domain domain) Returns an unmodifiable list of credentials for the specified domain.Returns all theDomains that this credential provider has.Computes the relative path from the current page to this store.Return theCredentialsStoreActionfor this store.booleanhasPermission2(org.springframework.security.core.Authentication a, Permission permission) Checks if the given principle has the given permission.booleanremoveCredentials(Domain domain, Credentials credentials) booleanremoveDomain(Domain domain) Removes an existingDomainand all associatedCredentials.voidsave()Persists the state of this object into XML.booleanupdateCredentials(Domain domain, Credentials current, Credentials replacement) Updates the specifiedCredentialsfrom the specifiedDomainfor thisCredentialsStorewith the supplied replacement.booleanupdateDomain(Domain current, Domain replacement) Updates an existingDomainkeeping the existing associatedCredentials.Methods inherited from class com.cloudbees.plugins.credentials.CredentialsStore
_isApplicable, addDomain, checkPermission, getContextDisplayName, getContextIconClassName, getCredentialsDescriptors, getDisplayName, getDomainByName, getProvider, getProviderOrDie, getRelativeLinkTo, getRelativeLinkToAction, getScopes, hasPermission, hasPermission, isApplicable, isDomainsModifiableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface hudson.security.AccessControlled
checkAnyPermission, hasAnyPermission
-
Method Details
-
getStoreAction
Return theCredentialsStoreActionfor this store. The action will be displayed as a sub-item of theViewCredentialsAction. Returnnullif this store will take control of displaying its action (which will be the case for legacy implementations)- Overrides:
getStoreActionin classCredentialsStore- Returns:
- the
CredentialsStoreActionfor this store to be rendered inViewCredentialsActionornullfor old implementations compiled against pre 2.0 versions of credentials plugin.
-
getContext
Returns the context within which this store operates. Credentials in this store will be available to child contexts (unlessCredentialsScope.SYSTEMis valid for the store) but will not be available to parent contexts.- Specified by:
getContextin classCredentialsStore- Returns:
- the context within which this store operates.
-
hasPermission2
public boolean hasPermission2(@NonNull org.springframework.security.core.Authentication a, @NonNull Permission permission) Checks if the given principle has the given permission.- Specified by:
hasPermission2in interfaceAccessControlled- Overrides:
hasPermission2in classCredentialsStore- Parameters:
a- the principle.permission- the permission.- Returns:
falseif the user doesn't have the permission.
-
getACL
- Specified by:
getACLin interfaceAccessControlled- Overrides:
getACLin classCredentialsStore
-
getDomains
Returns all theDomains that this credential provider has. Most implementers ofCredentialsStorewill probably want to override this method.- Overrides:
getDomainsin classCredentialsStore- Returns:
- the list of domains.
-
getCredentials
Returns an unmodifiable list of credentials for the specified domain.- Specified by:
getCredentialsin classCredentialsStore- Parameters:
domain- the domain.- Returns:
- the possibly empty (e.g. for an unknown
Domain) unmodifiable list of credentials for the specified domain.
-
addDomain
Adds a newDomainwith seed credentials.- Overrides:
addDomainin classCredentialsStore- Parameters:
domain- the domain.credentials- the initial credentials with which to populate the domain.- Returns:
trueif theCredentialsStorewas modified.- Throws:
IOException- if the change could not be persisted.
-
removeDomain
Removes an existingDomainand all associatedCredentials.- Overrides:
removeDomainin classCredentialsStore- Parameters:
domain- the domain.- Returns:
trueif theCredentialsStorewas modified.- Throws:
IOException- if the change could not be persisted.
-
updateDomain
public boolean updateDomain(@NonNull Domain current, @NonNull Domain replacement) throws IOException Updates an existingDomainkeeping the existing associatedCredentials.- Overrides:
updateDomainin classCredentialsStore- Parameters:
current- the domain to update.replacement- the new replacement domain.- Returns:
trueif theCredentialsStorewas modified.- Throws:
IOException- if the change could not be persisted.
-
addCredentials
public boolean addCredentials(@NonNull Domain domain, @NonNull Credentials credentials) throws IOException - Specified by:
addCredentialsin classCredentialsStore- Parameters:
domain- the domain.credentials- the credentials- Returns:
trueif theCredentialsStorewas modified.- Throws:
IOException- if the change could not be persisted.
-
removeCredentials
public boolean removeCredentials(@NonNull Domain domain, @NonNull Credentials credentials) throws IOException - Specified by:
removeCredentialsin classCredentialsStore- Parameters:
domain- the domain.credentials- the credentials- Returns:
trueif theCredentialsStorewas modified.- Throws:
IOException- if the change could not be persisted.
-
updateCredentials
public boolean updateCredentials(@NonNull Domain domain, @NonNull Credentials current, @NonNull Credentials replacement) throws IOException Updates the specifiedCredentialsfrom the specifiedDomainfor thisCredentialsStorewith the supplied replacement.- Specified by:
updateCredentialsin classCredentialsStore- Parameters:
domain- the domain.current- the credentials to update.replacement- the new replacement credentials.- Returns:
trueif theCredentialsStorewas modified.- Throws:
IOException- if the change could not be persisted.
-
getRelativeLinkToContext
Computes the relative path from the current page to this store.- Overrides:
getRelativeLinkToContextin classCredentialsStore- Returns:
- the relative path from the current page or
null
-
save
Persists the state of this object into XML. Default implementation delegates toCredentialsStore.getContext()if it implementsSaveableotherwise dropping back to a no-op.- Specified by:
savein interfaceSaveable- Overrides:
savein classCredentialsStore- Throws:
IOException- See Also:
-