Package com.networknt.graphql.security
Class JwtVerifyHandler
- java.lang.Object
-
- com.networknt.graphql.security.JwtVerifyHandler
-
- All Implemented Interfaces:
com.networknt.handler.LightHttpHandler,com.networknt.handler.MiddlewareHandler,com.networknt.security.IJwtVerifyHandler,io.undertow.server.HttpHandler
public class JwtVerifyHandler extends Object implements com.networknt.handler.MiddlewareHandler, com.networknt.security.IJwtVerifyHandler
This is the JWT token verifier for GraphQL. Given there is no OpenAPI spec available for scopes, we have to verify the scope just based on query and mutation which is read and write. Regarding to the authorization, GraphQL spec doesn't have anything built-in and it is recommended to handle at the business logic layer. As we are trying to address the cross-cutting concerns at middleware level within the framework, we don't want to inject anything extra into the schema for authorization.- Author:
- Steve Hu
-
-
Constructor Summary
Constructors Constructor Description JwtVerifyHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.networknt.security.JwtVerifiergetJwtVerifier()io.undertow.server.HttpHandlergetNext()voidhandleRequest(io.undertow.server.HttpServerExchange exchange)booleanisEnabled()protected booleanmatchedScopes(List<String> jwtScopes, List<String> specScopes)voidregister()voidreload()com.networknt.handler.MiddlewareHandlersetNext(io.undertow.server.HttpHandler next)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
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 interfacecom.networknt.handler.MiddlewareHandler
-
setNext
public com.networknt.handler.MiddlewareHandler setNext(io.undertow.server.HttpHandler next)
- Specified by:
setNextin interfacecom.networknt.handler.MiddlewareHandler
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfacecom.networknt.handler.MiddlewareHandler
-
register
public void register()
- Specified by:
registerin interfacecom.networknt.handler.MiddlewareHandler
-
reload
public void reload()
- Specified by:
reloadin interfacecom.networknt.handler.MiddlewareHandler
-
getJwtVerifier
public com.networknt.security.JwtVerifier getJwtVerifier()
- Specified by:
getJwtVerifierin interfacecom.networknt.security.IJwtVerifyHandler
-
-