public class JWTAuthenticator extends java.lang.Object implements Authenticator
| Constructor and Description |
|---|
JWTAuthenticator()
Creates a new JWT authentication strategy
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterAssociated() |
void |
authorize(java.lang.String jwt)
Sets the JWT access token on the authorization strategy, overriting any existing access token.
|
void |
deauthorize()
Deauthorizes the current user and clears any persistent state with regards to the current user.
|
java.util.Date |
getExpiration()
Returns the expire date of the access token.
|
void |
getToken(CompletionHandler<java.lang.String> handler)
Returns an access token of this authenticator.
|
boolean |
isAuthorized()
Returns True if the user is logically authorized.
|
void |
refreshToken(CompletionHandler<java.lang.String> handler)
Refresh an access token of this authenticator.
|
public JWTAuthenticator()
public void afterAssociated()
public boolean isAuthorized()
AuthenticatorThis may not mean the user has a valid access token yet, but the authentication strategy should be able to obtain one without further user interaction.
isAuthorized in interface AuthenticatorAuthenticatorpublic void authorize(@NonNull
java.lang.String jwt)
jwt - the new JSON Web Token to usepublic void deauthorize()
AuthenticatorPhone is registered,
it should be deregistered before calling this method.deauthorize in interface AuthenticatorAuthenticatorpublic void getToken(@NonNull
CompletionHandler<java.lang.String> handler)
AuthenticatorThis may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes.
getToken in interface Authenticatorhandler - a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.Authenticatorpublic void refreshToken(CompletionHandler<java.lang.String> handler)
AuthenticatorThis may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes.
refreshToken in interface Authenticatorhandler - a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.public java.util.Date getExpiration()