public class TokenBasedAuthentication extends Object implements Authentication
| Modifier and Type | Field and Description |
|---|---|
static String |
TOKEN_ATTRIBUTE
The name of the login token attribute.
|
static long |
TOKEN_EXPIRATION
Default expiration time for login tokens is 2 hours.
|
| Constructor and Description |
|---|
TokenBasedAuthentication(String token,
long tokenExpiration,
Session session) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
authenticate(Credentials credentials)
True if the Credentials identify the
User related to this
Authentication. |
boolean |
canHandle(Credentials credentials)
An Authentication may only be able to handle certain types of
Credentials as the authentication process is tightly coupled
to the semantics of the Credentials. |
static Credentials |
createToken(org.apache.jackrabbit.api.security.user.User user,
SimpleCredentials credentials,
long tokenExpiration,
Session session)
Create a new token node for the specified user.
|
static boolean |
doCreateToken(Credentials credentials)
Returns
true if the specified credentials
should be used to create a new login token. |
static Node |
getTokenNode(org.apache.jackrabbit.api.security.authentication.token.TokenCredentials credentials,
Session session) |
static boolean |
isMandatoryAttribute(String attributeName)
|
static boolean |
isTokenBasedLogin(Credentials credentials)
Returns
true if the given credentials object
is an instance of TokenCredentials. |
public static final long TOKEN_EXPIRATION
public static final String TOKEN_ATTRIBUTE
public TokenBasedAuthentication(String token, long tokenExpiration, Session session) throws RepositoryException
RepositoryExceptionpublic boolean canHandle(Credentials credentials)
AuthenticationCredentials as the authentication process is tightly coupled
to the semantics of the Credentials.
E.g.: A ticket based Authentication is dependant on a
Credentials implementation which allows access to this ticket.canHandle in interface Authenticationcredentials - in questionstrue if the current Authentication handles the given CredentialsAuthentication.canHandle(javax.jcr.Credentials)public boolean authenticate(Credentials credentials) throws RepositoryException
AuthenticationUser related to this
Authentication.authenticate in interface Authenticationcredentials - to verifytrue if Credentials identify the
User.RepositoryException - If an error occurs.Authentication.authenticate(javax.jcr.Credentials)public static boolean isTokenBasedLogin(Credentials credentials)
true if the given credentials object
is an instance of TokenCredentials.credentials - true if the given credentials object
is an instance of TokenCredentials; false otherwise.public static boolean isMandatoryAttribute(String attributeName)
attributeName - true if the specified attributeName
starts with or equals TOKEN_ATTRIBUTE.public static boolean doCreateToken(Credentials credentials)
true if the specified credentials
should be used to create a new login token.credentials - true if upon successful authentication a new
login token should be created; false otherwise.public static Credentials createToken(org.apache.jackrabbit.api.security.user.User user, SimpleCredentials credentials, long tokenExpiration, Session session) throws RepositoryException
user - credentials - tokenExpiration - session - TokenCredentials to be used for
further login actions against this Authentication implementation.RepositoryException - If there is no node corresponding to the
specified user in the current workspace or if an error occurs while
creating the token node.public static Node getTokenNode(org.apache.jackrabbit.api.security.authentication.token.TokenCredentials credentials, Session session) throws RepositoryException
RepositoryExceptionCopyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.