Class BasicAuthMiddleware

    • Constructor Detail

      • BasicAuthMiddleware

        public BasicAuthMiddleware()
      • BasicAuthMiddleware

        @Deprecated
        public BasicAuthMiddleware​(com.networknt.basicauth.BasicAuthConfig cfg)
        Deprecated.
        Please note that this constructor is only for testing to load different config files to test different configurations.
        Parameters:
        cfg - BasicAuthConfig
    • Method Detail

      • handleBasicAuth

        public com.networknt.status.Status handleBasicAuth​(LightLambdaExchange exchange,
                                                           String requestPath,
                                                           String auth)
        Handle basic authentication header. If the request coming in has an incorrect format for basic auth, we block the request. We also block the request if the path is not configured to have basic authentication.
        Parameters:
        exchange - - current exchange.
        requestPath - - path found within current request.
        auth - - auth string
        Returns:
        Status to indicate if an error or success.
      • isEnabled

        public boolean isEnabled()
        Description copied from interface: LambdaHandler
        Indicate if this handler is enabled or not.
        Specified by:
        isEnabled in interface LambdaHandler
        Returns:
        boolean true if enabled
      • register

        public void register()
        Description copied from interface: LambdaHandler
        Register this handler to the handler registration.
        Specified by:
        register in interface LambdaHandler
      • reload

        public void reload()
        Description copied from interface: LambdaHandler
        Reload config values in case the config values changed by config server.
        Specified by:
        reload in interface LambdaHandler
      • isAsynchronous

        public boolean isAsynchronous()
        Description copied from interface: LambdaHandler
        Indicate if this middleware handler is asynchronous or not.
        Specified by:
        isAsynchronous in interface LambdaHandler
        Returns:
        boolean true if asynchronous
      • isContinueOnFailure

        public boolean isContinueOnFailure()
        Description copied from interface: MiddlewareHandler
        Indicate if this middleware handler will continue on failure or not.
        Specified by:
        isContinueOnFailure in interface MiddlewareHandler
        Returns:
        boolean true if continue on failure
      • isAudited

        public boolean isAudited()
        Description copied from interface: MiddlewareHandler
        Indicate if this middleware handler is audited or not.
        Specified by:
        isAudited in interface MiddlewareHandler
        Returns:
        boolean true if audited