Package com.hcl.labs.domi
Class RefreshTokenHandler
- java.lang.Object
-
- io.vertx.ext.web.handler.impl.BodyHandlerImpl
-
- com.hcl.labs.domi.RefreshTokenHandler
-
- All Implemented Interfaces:
io.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
,io.vertx.ext.web.handler.BodyHandler
- Direct Known Subclasses:
RevokeTokenHandler
public class RefreshTokenHandler extends io.vertx.ext.web.handler.impl.BodyHandlerImpl
- Author:
- Paul Withers Handlers for refreshing OAuth tokens. Bearer token expected on incoming. If included, the token is refreshed with the relevant provider
-
-
Constructor Summary
Constructors Constructor Description RefreshTokenHandler(io.vertx.ext.auth.oauth2.OAuth2Auth oAuthProvider, String providerName)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected io.vertx.core.http.HttpServerResponse
createJsonResponse(io.vertx.ext.web.RoutingContext ctx)
Creates a JSON Response with basic headersprotected void
endWithError(io.vertx.ext.web.RoutingContext ctx, int status, String errMsg)
Ends a request by sending an error codeprotected io.vertx.core.Future<Void>
extractToken(io.vertx.ext.web.RoutingContext ctx, String storeKey)
Future to verify a bearer token was passed and seed it into the User objectprotected io.vertx.ext.auth.oauth2.OAuth2Auth
getOAuthProvider()
protected String
getProviderName()
void
handle(io.vertx.ext.web.RoutingContext ctx)
-
-
-
Constructor Detail
-
RefreshTokenHandler
public RefreshTokenHandler(io.vertx.ext.auth.oauth2.OAuth2Auth oAuthProvider, String providerName)
Constructor- Parameters:
oAuthProvider
- OAuth2Auth provider seeded client ID and secretproviderName
- OAuth provider's name
-
-
Method Detail
-
getOAuthProvider
protected io.vertx.ext.auth.oauth2.OAuth2Auth getOAuthProvider()
- Returns:
- the OAuth2Auth provider for this endpoint
-
getProviderName
protected String getProviderName()
- Returns:
- the OAuth provider name for this endpoint
-
createJsonResponse
protected io.vertx.core.http.HttpServerResponse createJsonResponse(io.vertx.ext.web.RoutingContext ctx)
Creates a JSON Response with basic headers- Parameters:
ctx
- RoutingContext for the request- Returns:
- HttpServerResponse to send back to the user
-
endWithError
protected void endWithError(io.vertx.ext.web.RoutingContext ctx, int status, String errMsg)
Ends a request by sending an error code- Parameters:
ctx
- Contextstatus
- HTTP error code to returnerrMsg
- to be returned to the user
-
extractToken
protected io.vertx.core.Future<Void> extractToken(io.vertx.ext.web.RoutingContext ctx, String storeKey)
Future to verify a bearer token was passed and seed it into the User object- Parameters:
ctx
- RoutingContext for the requeststoreKey
- the property within the User object in which to store the token- Returns:
- succeeded or failed future
-
handle
public void handle(io.vertx.ext.web.RoutingContext ctx)
- Specified by:
handle
in interfaceio.vertx.core.Handler<io.vertx.ext.web.RoutingContext>
- Overrides:
handle
in classio.vertx.ext.web.handler.impl.BodyHandlerImpl
-
-