public interface TokenValidator
| Modifier and Type | Interface and Description |
|---|---|
static class |
TokenValidator.Policy
Specifies the desired enforcement policy for ASAP authentication.
|
| Modifier and Type | Method and Description |
|---|---|
TokenValidator |
audience(Iterable<String> additionalAudienceValues)
As for
audience(String...). |
default TokenValidator |
audience(String... additionalAudienceValues)
Specifies the audience(s) that will be accepted.
|
TokenValidator |
impersonationIssuer(Iterable<String> impersonationIssuers)
As for
impersonationIssuer(String...). |
default TokenValidator |
impersonationIssuer(String... impersonationIssuers)
Specifies the issuer(s) that are authorized to impersonate a user while using this resource.
|
TokenValidator |
issuer(Iterable<String> authorizedIssuers)
As for
issuer(String...). |
default TokenValidator |
issuer(String... authorizedIssuers)
Specifies the issuer(s) that are authorized to use this resource.
|
TokenValidator |
policy(TokenValidator.Policy policy)
Specifies the validation policy for this validator.
|
TokenValidator |
subject(Iterable<String> authorizedSubjects)
As for
subject(String...). |
default TokenValidator |
subject(String... authorizedSubjects)
Specifies the effective subject(s) that are authorized to use this resource.
|
TokenValidator |
subjectImpersonation(boolean subjectImpersonation)
Deprecated.
move/copy issuers that are allowed to impersonate users from the 'issuer' to the 'impersonationIssuer' list
|
ValidationResult |
validate(Optional<String> authHeader)
Perform the validation.
|
default TokenValidator issuer(String... authorizedIssuers)
Issuer validation is appropriate unless the resource is intended to be used as an open service that many different issuers can access.
Failures reported as: ValidationResult.Decision.NOT_AUTHORIZED
authorizedIssuers - the issuers that are authorized to use this resource; null elements are not permittedthisTokenValidator issuer(Iterable<String> authorizedIssuers)
issuer(String...).authorizedIssuers - as for issuer(String...)thisdefault TokenValidator impersonationIssuer(String... impersonationIssuers)
Issuer validation is required to be used if the resource is intended to be used in the context of a user, with all the access checks
Failures reported as: ValidationResult.Decision.NOT_AUTHORIZED
impersonationIssuers - the issuers that are authorized to impersonate a user while using this resource;
null elements are not permittedthisTokenValidator impersonationIssuer(Iterable<String> impersonationIssuers)
impersonationIssuer(String...).impersonationIssuers - as for impersonationIssuer(String...)this@Deprecated TokenValidator subjectImpersonation(boolean subjectImpersonation)
The subject is ignored by default. If subject impersonation is enabled, then the subject is understood
to identify a user known to the application, or anonymous access when the subject is not specified. If
subject impersonation is enabled, then the issuer whitelist MUST
be provided, or all tokens will be rejected.
The validation service only approves the request for subject impersonation. The actual implementation is left up to the surrounding framework.
subjectImpersonation - true to use subject impersonationthisdefault TokenValidator subject(String... authorizedSubjects)
The subject is ignored by default. If an explicit whitelist is provided, then the effective subject must be in it for the token to pass authorization. The effective subject is defined as:
Failures reported as: ValidationResult.Decision.NOT_AUTHORIZED
authorizedSubjects - the subjects that are authorized to use this resource; null elements are not
permitted, and an empty list disables this check.thisTokenValidator subject(Iterable<String> authorizedSubjects)
subject(String...).authorizedSubjects - as for subject(String...)thisdefault TokenValidator audience(String... additionalAudienceValues)
By default, the globally configured audience is assumed to be the expected value, and it is always accepted. If the token does not specify either the globally configured audience or one of the alternate values (if any) provided here, then it will not pass authentication.
For security reasons, it is not possible to disable audience validation. Note: This is an authentication failure, because the token itself is not accepted as valid if it is meant for some other service.
Failures reported as: ValidationResult.Decision.NOT_AUTHENTICATED
additionalAudienceValues - the audience values that, in addition to the globally configured default, are
acceptable for other services to specify when creating a token to access this
resourcethisTokenValidator audience(Iterable<String> additionalAudienceValues)
audience(String...).additionalAudienceValues - as for audience(String...)thisTokenValidator policy(TokenValidator.Policy policy)
By default, the validator will use TokenValidator.Policy.REQUIRE. If those are not the desired authentication
semantics, then this method can be used to specify one of the other policies, instead.
The most useful ones are probably TokenValidator.Policy.IGNORE (to disable ASAP authentication when it might
otherwise have been inherited from a superclass or the surrounding context) and TokenValidator.Policy.OPTIONAL,
to allow ASAP authentication to be validated when it is attempted, but without mandating its use.
policy - the enforcement policy to usethisValidationResult validate(Optional<String> authHeader)
authHeader - the contents of the Authorization header from the HTTP request, if any.authHeaderCopyright © 2017 Atlassian. All rights reserved.