public class TokenBasedAuthentication extends Object implements Authentication
| Modifier and Type | Field and Description | 
|---|---|
| static String | PARAM_COMPATDeprecated. 
 This system parameter allows to enable backwards compatible
 behavior of the  TokenBasedAuthentication. Note that as of OAK 1.0
 this flag will no be supported. | 
| static String | TOKEN_ATTRIBUTEThe name of the login token attribute. | 
| static long | TOKEN_EXPIRATIONDefault 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  Userrelated to this
 Authentication. | 
| boolean | canHandle(Credentials credentials)An Authentication may only be able to handle certain types of
  Credentialsas the authentication process is tightly coupled
 to the semantics of theCredentials. | 
| static Credentials | createToken(User user,
           SimpleCredentials credentials,
           long tokenExpiration,
           Session session)Create a new token node for the specified user. | 
| static boolean | doCreateToken(Credentials credentials)Returns  trueif the specifiedcredentialsshould be used to create a new login token. | 
| static Node | getTokenNode(TokenCredentials credentials,
            Session session) | 
| static String | getUserId(TokenCredentials tokenCredentials,
         Session session) | 
| static boolean | isMandatoryAttribute(String attributeName) | 
| static boolean | isTokenBasedLogin(Credentials credentials)Returns  trueif the givencredentialsobject
 is an instance ofTokenCredentials. | 
public static final long TOKEN_EXPIRATION
public static final String TOKEN_ATTRIBUTE
public static final String PARAM_COMPAT
TokenBasedAuthentication. Note that as of OAK 1.0
 this flag will no be supported.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(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(TokenCredentials credentials, Session session) throws RepositoryException
RepositoryExceptionpublic static String getUserId(TokenCredentials tokenCredentials, Session session) throws RepositoryException
RepositoryExceptionCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.