public abstract class AuthenticationTokenSource<T,C extends com.cloudbees.plugins.credentials.Credentials> extends Object implements hudson.ExtensionPoint
Credentials into authentication tokens| Modifier | Constructor and Description |
|---|---|
protected |
AuthenticationTokenSource(Class<T> tokenClass,
Class<C> credentialsClass)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<C extends com.cloudbees.plugins.credentials.Credentials> |
consumes(Class<C> credentialsClass)
Checks if this source consumes
Credentials of the specified type. |
boolean |
consumes(com.cloudbees.plugins.credentials.Credentials credentials)
Checks if this source consumes the specific
Credentials instance. |
abstract T |
convert(C credential)
Converts the specified credentials into a token.
|
boolean |
fits(AuthenticationTokenContext<?> context)
Checks if this source fits the specified context.
|
protected boolean |
isFit(AuthenticationTokenContext<? super T> context)
Checks if this source fits the specified context, override this method
|
com.cloudbees.plugins.credentials.CredentialsMatcher |
matcher()
Produces a
CredentialsMatcher for this specific AuthenticationTokenSource. |
<T> boolean |
produces(Class<T> tokenClass)
Checks if this source produces the specified token type.
|
@NonNull public abstract T convert(@NonNull C credential) throws AuthenticationTokenException
credential - the credentials to convert.AuthenticationTokenException - if the specific credentials could not be converted.@NonNull @OverrideMustInvoke(value=ANYTIME) public com.cloudbees.plugins.credentials.CredentialsMatcher matcher()
CredentialsMatcher for this specific AuthenticationTokenSource.
Implementations only need to override this method when they can only process a sub-set of the
credential class that they convert. For example if UsernamePasswordCredentials are converted
into a specific authentication token, but only for those cases where there is a password and the username
is between 3 and 8 lowercase letters then the specific source implementation would likely override
this method and return a more specific CredentialsMatcher in order to avoid convert(Credentials)
having to throw an AuthenticationTokenException.CredentialsMatcher for this source.public final <T> boolean produces(@NonNull
Class<T> tokenClass)
T - the token type.tokenClass - the token type.true if and only if this source can produce tokens of the specified type.public final <C extends com.cloudbees.plugins.credentials.Credentials> boolean consumes(@NonNull
Class<C> credentialsClass)
Credentials of the specified type.C - the credential type.credentialsClass - the credential type.true if and only if this source can consume credentials of the specified type.public final boolean consumes(@NonNull
com.cloudbees.plugins.credentials.Credentials credentials)
Credentials instance.credentials - the credentials.true if and only if this source can consume credentials of the specified type.public final boolean fits(AuthenticationTokenContext<?> context)
context - the context that an authentication token is required in.true if and only if this source fits the specified context.protected boolean isFit(AuthenticationTokenContext<? super T> context)
context - the context that an authentication token is required in.true if and only if this source fits the specified context.Copyright © 2016–2020. All rights reserved.