public class OAuth2AuthProviderImpl extends Object implements OAuth2Auth, AuthProviderInternal
| Constructor and Description |
|---|
OAuth2AuthProviderImpl(Vertx vertx,
OAuth2ClientOptions config) |
| Modifier and Type | Method and Description |
|---|---|
void |
authenticate(JsonObject authInfo,
Handler<AsyncResult<User>> resultHandler)
Authenticate a user.
|
String |
authorizeURL(JsonObject params)
Generate a redirect URL to the authN/Z backend.
|
OAuth2Auth |
decodeToken(String token,
Handler<AsyncResult<AccessToken>> handler)
Deprecated.
|
OAuth2ClientOptions |
getConfig() |
OAuth2Flow |
getFlow() |
OAuth2FlowType |
getFlowType()
Returns the configured flow type for the Oauth2 provider.
|
JWT |
getJWT() |
String |
getScopeSeparator()
Deprecated.
|
void |
getToken(JsonObject credentials,
Handler<AsyncResult<AccessToken>> handler)
Deprecated.
|
Vertx |
getVertx() |
void |
internalLoadJWK(Handler<AsyncResult<JsonObject>> handler) |
OAuth2Auth |
introspectToken(String token,
String tokenType,
Handler<AsyncResult<AccessToken>> handler)
Query an OAuth 2.0 authorization server to determine the active state of an OAuth 2.0 token and to determine
meta-information about this token.
|
OAuth2Auth |
loadJWK(Handler<AsyncResult<Void>> handler)
Loads a JWK Set from the remote provider.
|
OAuth2Auth |
missingKeyHandler(Handler<String> handler)
Handled to be called when a key (mentioned on a JWT) is missing from the current config.
|
OAuth2Auth |
rbacHandler(OAuth2RBAC rbac) |
void |
verifyIsUsingPassword()
This is a verification step, it can abort by throwing a RuntimeException.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, create, create, create, createKeycloak, introspectTokenpublic OAuth2AuthProviderImpl(Vertx vertx, OAuth2ClientOptions config)
public OAuth2Auth missingKeyHandler(Handler<String> handler)
OAuth2AuthOAuth2Auth.loadJWK(Handler) but being careful to implement
some rate limiting function.
This method isn't generic for several reasons. The provider is not aware of the capabilities
of the backend IdP in terms of max allowed API calls. Some validation could be done at the
key id, which only the end user is aware of.missingKeyHandler in interface OAuth2AuthOAuth2Auth.missingKeyHandler(Handler)public void verifyIsUsingPassword()
AuthProviderInternalverifyIsUsingPassword in interface AuthProviderInternalpublic OAuth2Auth loadJWK(Handler<AsyncResult<Void>> handler)
OAuth2AuthloadJWK in interface OAuth2Authpublic void internalLoadJWK(Handler<AsyncResult<JsonObject>> handler)
public OAuth2Auth rbacHandler(OAuth2RBAC rbac)
rbacHandler in interface OAuth2Authpublic OAuth2ClientOptions getConfig()
public Vertx getVertx()
public JWT getJWT()
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 authorizeURL(JsonObject params)
OAuth2AuthauthorizeURL in interface OAuth2Auth@Deprecated public void getToken(JsonObject credentials, Handler<AsyncResult<AccessToken>> handler)
OAuth2AuthgetToken in interface OAuth2Authcredentials - - JSON with the options, each flow requires different options.handler - - The handler returning the results.@Deprecated public OAuth2Auth decodeToken(String token, Handler<AsyncResult<AccessToken>> handler)
OAuth2AuthAccessToken object. This is useful to handle bearer JWT tokens.decodeToken in interface OAuth2Authtoken - the access token (base64 string)handler - A handler to receive the eventpublic OAuth2Auth introspectToken(String token, String tokenType, Handler<AsyncResult<AccessToken>> handler)
OAuth2AuthintrospectToken in interface OAuth2Authtoken - the access token (base64 string)tokenType - hint to the token type e.g.: `access_token`handler - A handler to receive the event@Deprecated public String getScopeSeparator()
OAuth2AuthgetScopeSeparator in interface OAuth2Authpublic OAuth2FlowType getFlowType()
OAuth2AuthgetFlowType in interface OAuth2Authpublic OAuth2Flow getFlow()
Copyright © 2020. All rights reserved.