Package com.networknt.router.middleware
Class SAMLTokenHandler
- java.lang.Object
-
- com.networknt.router.middleware.SAMLTokenHandler
-
- All Implemented Interfaces:
LightHttpHandler,MiddlewareHandler,io.undertow.server.HttpHandler
public class SAMLTokenHandler extends Object implements MiddlewareHandler
This is a middleware handler that is responsible for getting a JWT access token from OAuth 2.0 provider for the particular router client. In this use case it is assumed the client has a signed saml and a signed JWT token in the incoming HTTP headers. These two tokens will be passed to the authorization server to get the JWT access token. This handler will also be responsible for checking if the cached token is about to expired or not. In which case, it will renew the token in another thread. When request comes and the cached token is already expired, then it will block the request and go to the OAuth provider to get a new token and then resume the request to the next handler in the chain. This handler is very similar to the TokenHandler except it doesn't use the client credential grant type.
-
-
Field Summary
Fields Modifier and Type Field Description static StringCLIENT_CONFIG_NAMEstatic Map<String,Object>configstatic StringCONFIG_NAMEstatic StringCONFIG_SECURITYstatic StringENABLEDprotected io.undertow.server.HttpHandlernext-
Fields inherited from interface com.networknt.handler.LightHttpHandler
AUDIT_CONFIG_NAME, AUDIT_ON_ERROR, AUDIT_STACK_TRACE, auditConfig, auditOnError, auditStackTrace, ERROR_NOT_DEFINED
-
-
Constructor Summary
Constructors Constructor Description SAMLTokenHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.undertow.server.HttpHandlergetNext()voidhandleRequest(io.undertow.server.HttpServerExchange exchange)booleanisEnabled()voidregister()voidreload()MiddlewareHandlersetNext(io.undertow.server.HttpHandler next)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.networknt.handler.LightHttpHandler
setExchangeStatus, setExchangeStatus, setExchangeStatus
-
-
-
-
Field Detail
-
CONFIG_NAME
public static final String CONFIG_NAME
- See Also:
- Constant Field Values
-
CLIENT_CONFIG_NAME
public static final String CLIENT_CONFIG_NAME
- See Also:
- Constant Field Values
-
ENABLED
public static final String ENABLED
- See Also:
- Constant Field Values
-
CONFIG_SECURITY
public static final String CONFIG_SECURITY
- See Also:
- Constant Field Values
-
next
protected volatile io.undertow.server.HttpHandler next
-
-
Method Detail
-
handleRequest
public void handleRequest(io.undertow.server.HttpServerExchange exchange) throws Exception- Specified by:
handleRequestin interfaceio.undertow.server.HttpHandler- Throws:
Exception
-
getNext
public io.undertow.server.HttpHandler getNext()
- Specified by:
getNextin interfaceMiddlewareHandler
-
setNext
public MiddlewareHandler setNext(io.undertow.server.HttpHandler next)
- Specified by:
setNextin interfaceMiddlewareHandler
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfaceMiddlewareHandler
-
register
public void register()
- Specified by:
registerin interfaceMiddlewareHandler
-
reload
public void reload()
- Specified by:
reloadin interfaceMiddlewareHandler
-
-