Class SystemCredentialsProvider.StoreImpl
java.lang.Object
com.cloudbees.plugins.credentials.CredentialsStore
com.cloudbees.plugins.credentials.SystemCredentialsProvider.StoreImpl
- All Implemented Interfaces:
Saveable
,AccessControlled
- Enclosing class:
- SystemCredentialsProvider
Our
CredentialsStore
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addCredentials
(Domain domain, Credentials credentials) boolean
addDomain
(Domain domain, List<Credentials> credentials) Adds a newDomain
with 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 theDomain
s that this credential provider has.Return theCredentialsStoreAction
for this store.boolean
hasPermission2
(org.springframework.security.core.Authentication a, Permission permission) Checks if the given principle has the given permission.boolean
removeCredentials
(Domain domain, Credentials credentials) boolean
removeDomain
(Domain domain) Removes an existingDomain
and all associatedCredentials
.void
save()
Persists the state of this object into XML.boolean
updateCredentials
(Domain domain, Credentials current, Credentials replacement) Updates the specifiedCredentials
from the specifiedDomain
for thisCredentialsStore
with the supplied replacement.boolean
updateDomain
(Domain current, Domain replacement) Updates an existingDomain
keeping the existing associatedCredentials
.Methods inherited from class com.cloudbees.plugins.credentials.CredentialsStore
_isApplicable, addDomain, checkPermission, getContextDisplayName, getCredentialsDescriptors, getDisplayName, getDomainByName, getProvider, getProviderOrDie, getRelativeLinkTo, getRelativeLinkToAction, getRelativeLinkToContext, getScopes, hasPermission, hasPermission, isApplicable, isDomainsModifiable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, hasAnyPermission
-
Constructor Details
-
StoreImpl
public StoreImpl()Default constructor.
-
-
Method Details
-
getContext
Returns the context within which this store operates. Credentials in this store will be available to child contexts (unlessCredentialsScope.SYSTEM
is valid for the store) but will not be available to parent contexts.- Specified by:
getContext
in 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:
hasPermission2
in interfaceAccessControlled
- Overrides:
hasPermission2
in classCredentialsStore
- Parameters:
a
- the principle.permission
- the permission.- Returns:
false
if the user doesn't have the permission.
-
getACL
Description copied from class:CredentialsStore
- Specified by:
getACL
in interfaceAccessControlled
- Overrides:
getACL
in classCredentialsStore
-
getDomains
Returns all theDomain
s that this credential provider has. Most implementers ofCredentialsStore
will probably want to override this method.- Overrides:
getDomains
in classCredentialsStore
- Returns:
- the list of domains.
-
getCredentials
Returns an unmodifiable list of credentials for the specified domain.- Specified by:
getCredentials
in 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 newDomain
with seed credentials.- Overrides:
addDomain
in classCredentialsStore
- Parameters:
domain
- the domain.credentials
- the initial credentials with which to populate the domain.- Returns:
true
if theCredentialsStore
was modified.- Throws:
IOException
- if the change could not be persisted.
-
removeDomain
Removes an existingDomain
and all associatedCredentials
.- Overrides:
removeDomain
in classCredentialsStore
- Parameters:
domain
- the domain.- Returns:
true
if theCredentialsStore
was modified.- Throws:
IOException
- if the change could not be persisted.
-
updateDomain
public boolean updateDomain(@NonNull Domain current, @NonNull Domain replacement) throws IOException Updates an existingDomain
keeping the existing associatedCredentials
.- Overrides:
updateDomain
in classCredentialsStore
- Parameters:
current
- the domain to update.replacement
- the new replacement domain.- Returns:
true
if theCredentialsStore
was modified.- Throws:
IOException
- if the change could not be persisted.
-
addCredentials
public boolean addCredentials(@NonNull Domain domain, @NonNull Credentials credentials) throws IOException - Specified by:
addCredentials
in classCredentialsStore
- Parameters:
domain
- the domain.credentials
- the credentials- Returns:
true
if theCredentialsStore
was modified.- Throws:
IOException
- if the change could not be persisted.
-
removeCredentials
public boolean removeCredentials(@NonNull Domain domain, @NonNull Credentials credentials) throws IOException - Specified by:
removeCredentials
in classCredentialsStore
- Parameters:
domain
- the domain.credentials
- the credentials- Returns:
true
if theCredentialsStore
was 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 specifiedCredentials
from the specifiedDomain
for thisCredentialsStore
with the supplied replacement.- Specified by:
updateCredentials
in classCredentialsStore
- Parameters:
domain
- the domain.current
- the credentials to update.replacement
- the new replacement credentials.- Returns:
true
if theCredentialsStore
was modified.- Throws:
IOException
- if the change could not be persisted.
-
getStoreAction
Return theCredentialsStoreAction
for this store. The action will be displayed as a sub-item of theViewCredentialsAction
. Returnnull
if this store will take control of displaying its action (which will be the case for legacy implementations)- Overrides:
getStoreAction
in classCredentialsStore
- Returns:
- the
CredentialsStoreAction
for this store to be rendered inViewCredentialsAction
ornull
for old implementations compiled against pre 2.0 versions of credentials plugin.
-
save
Persists the state of this object into XML. Default implementation delegates toCredentialsStore.getContext()
if it implementsSaveable
otherwise dropping back to a no-op.- Specified by:
save
in interfaceSaveable
- Overrides:
save
in classCredentialsStore
- Throws:
IOException
- See Also:
-