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 |
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.
|
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 boolean isAuthorized()
Authenticator
This 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 Authenticator
Authenticator
public void authorize(@NonNull java.lang.String jwt)
jwt
- the new JSON Web Token to usepublic void deauthorize()
Authenticator
Phone
is registered,
it should be deregistered before calling this method.deauthorize
in interface Authenticator
Authenticator
public void getToken(@NonNull CompletionHandler<java.lang.String> handler)
Authenticator
This 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 Authenticator
handler
- a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.Authenticator
public void refreshToken(CompletionHandler<java.lang.String> handler)
Authenticator
This 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 Authenticator
handler
- a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.