Class 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
    • Field Summary

      • Fields inherited from interface com.networknt.handler.LightHttpHandler

        AUDIT_CONFIG_NAME, AUDIT_ON_ERROR, AUDIT_STACK_TRACE, auditConfig, auditOnError, auditStackTrace, CONFIG_NAME, ERROR_NOT_DEFINED
    • Constructor Detail

      • JwtVerifyHandler

        public JwtVerifyHandler()
    • Method Detail

      • handleRequest

        public void handleRequest​(io.undertow.server.HttpServerExchange exchange)
                           throws Exception
        Specified by:
        handleRequest in interface io.undertow.server.HttpHandler
        Throws:
        Exception
      • matchedScopes

        protected boolean matchedScopes​(List<String> jwtScopes,
                                        List<String> specScopes)
      • getNext

        public io.undertow.server.HttpHandler getNext()
        Specified by:
        getNext in interface com.networknt.handler.MiddlewareHandler
      • setNext

        public com.networknt.handler.MiddlewareHandler setNext​(io.undertow.server.HttpHandler next)
        Specified by:
        setNext in interface com.networknt.handler.MiddlewareHandler
      • isEnabled

        public boolean isEnabled()
        Specified by:
        isEnabled in interface com.networknt.handler.MiddlewareHandler
      • register

        public void register()
        Specified by:
        register in interface com.networknt.handler.MiddlewareHandler
      • reload

        public void reload()
        Specified by:
        reload in interface com.networknt.handler.MiddlewareHandler
      • getJwtVerifier

        public com.networknt.security.JwtVerifier getJwtVerifier()
        Specified by:
        getJwtVerifier in interface com.networknt.security.IJwtVerifyHandler