public class JWTAuthProviderImpl extends Object implements JWTAuth
| Constructor and Description |
|---|
JWTAuthProviderImpl(Vertx vertx,
JWTAuthOptions config) |
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(JsonObject authInfo,
Handler<AsyncResult<User>> resultHandler)
Authenticate a user.
|
String |
generateToken(JsonObject claims,
JWTOptions options)
Generate a new JWT token.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, generateTokenpublic JWTAuthProviderImpl(Vertx vertx, JWTAuthOptions config)
public void authenticate(JsonObject authInfo, Handler<AsyncResult<User>> resultHandler)
AuthProviderThe first argument is a JSON object containing information for authenticating the user. What this actually contains depends on the specific implementation. In the case of a simple username/password based authentication it is likely to contain a JSON object with the following structure:
{
"username": "tim",
"password": "mypassword"
}
For other types of authentication it contain different information - for example a JWT token or OAuth bearer token.
If the user is successfully authenticated a User object is passed to the handler in an AsyncResult.
The user object can then be used for authorisation.
authenticate in interface AuthProviderauthInfo - The auth informationresultHandler - The result handlerpublic String generateToken(JsonObject claims, JWTOptions options)
JWTAuthgenerateToken in interface JWTAuthclaims - Json with user defined claims for a list of official claimsoptions - extra options for the generationCopyright © 2020. All rights reserved.