public class TokenBasedAuthentication extends Object implements Authentication
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_COMPAT
Deprecated.
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_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,
javax.jcr.Session session) |
Modifier and Type | Method and Description |
---|---|
boolean |
authenticate(javax.jcr.Credentials credentials)
True if the Credentials identify the
User related to this
Authentication. |
boolean |
canHandle(javax.jcr.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 javax.jcr.Credentials |
createToken(User user,
javax.jcr.SimpleCredentials credentials,
long tokenExpiration,
javax.jcr.Session session)
Create a new token node for the specified user.
|
static boolean |
doCreateToken(javax.jcr.Credentials credentials)
Returns
true if the specified credentials
should be used to create a new login token. |
static javax.jcr.Node |
getTokenNode(TokenCredentials credentials,
javax.jcr.Session session) |
static String |
getUserId(TokenCredentials tokenCredentials,
javax.jcr.Session session) |
static boolean |
isMandatoryAttribute(String attributeName)
|
static boolean |
isTokenBasedLogin(javax.jcr.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 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, javax.jcr.Session session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public boolean canHandle(javax.jcr.Credentials credentials)
Authentication
Credentials
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 Authentication
credentials
- in questionstrue
if the current Authentication handles the given CredentialsAuthentication.canHandle(javax.jcr.Credentials)
public boolean authenticate(javax.jcr.Credentials credentials) throws javax.jcr.RepositoryException
Authentication
User
related to this
Authentication.authenticate
in interface Authentication
credentials
- to verifytrue
if Credentials
identify the
User
.javax.jcr.RepositoryException
- If an error occurs.Authentication.authenticate(javax.jcr.Credentials)
public static boolean isTokenBasedLogin(javax.jcr.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(javax.jcr.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 javax.jcr.Credentials createToken(User user, javax.jcr.SimpleCredentials credentials, long tokenExpiration, javax.jcr.Session session) throws javax.jcr.RepositoryException
user
- credentials
- tokenExpiration
- session
- TokenCredentials
to be used for
further login actions against this Authentication implementation.javax.jcr.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 javax.jcr.Node getTokenNode(TokenCredentials credentials, javax.jcr.Session session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static String getUserId(TokenCredentials tokenCredentials, javax.jcr.Session session) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
Copyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.