public interface AuthenticationToken extends CredentialsContainer, Serializable
Authenticator.authenticate(AuthenticationToken)
to obtain a valid Authentication
for a principal (for
example a user).
Because applications represent user data and credentials in different ways, implementations of this interface are application-specific.
Modifier and Type | Interface and Description |
---|---|
static interface |
AuthenticationToken.AuthenticationTokenResolver<R extends Message>
Resolver to obtain an
AuthenticationToken from an authentication request using a generic Message . |
CredentialsContainer.CredentialsMatcher
Modifier and Type | Method and Description |
---|---|
static AuthenticationToken |
accountCredentials(String accountId,
String secret)
Create a basic
AuthenticationToken to represent a generic account authentication. |
static AuthenticationToken |
bearer(String token)
Create an
AuthenticationToken to represent a HttpHeaders.SCHEME_BEARER token authentication. |
Object |
getCredentials()
Returns the credentials submitted during the authentication process that verifies the submitted
getPrincipal() account identity. |
Object |
getPrincipal()
Get the principal to which this authentication token refers, i.e. the account identity submitted during the
authentication process.
|
static AuthenticationToken.AuthenticationTokenResolver<HttpRequest> |
httpBasicResolver()
Build a default
AuthenticationToken.AuthenticationTokenResolver for HTTP BASIC authentication scheme. |
static AuthenticationToken.AuthenticationTokenResolver<HttpRequest> |
httpBearerResolver()
Build a default
AuthenticationToken.AuthenticationTokenResolver for HTTP BEARER authentication scheme. |
defaultMatcher
Object getPrincipal()
Object getCredentials()
getPrincipal()
account identity.getCredentials
in interface CredentialsContainer
static AuthenticationToken accountCredentials(String accountId, String secret)
AuthenticationToken
to represent a generic account authentication. Account is identified
by an id and a secret (of String type).
This AuthenticationToken could for example represent the widely-used user authentication mechanism providing username and password.
accountId
- Account idsecret
- Secret (for example a password)static AuthenticationToken bearer(String token)
AuthenticationToken
to represent a HttpHeaders.SCHEME_BEARER
token authentication.token
- Bearer token valuestatic AuthenticationToken.AuthenticationTokenResolver<HttpRequest> httpBasicResolver()
AuthenticationToken.AuthenticationTokenResolver
for HTTP BASIC authentication scheme.AuthenticationToken.AuthenticationTokenResolver
static AuthenticationToken.AuthenticationTokenResolver<HttpRequest> httpBearerResolver()
AuthenticationToken.AuthenticationTokenResolver
for HTTP BEARER authentication scheme.AuthenticationToken.AuthenticationTokenResolver
Copyright © 2018 The Holon Platform. All rights reserved.