Class OAuth2Server


  • public class OAuth2Server
    extends Object
    An OAuth2 Server based on RFC-7628.
    Author:
    Pedro Igor
    • Constructor Detail

      • OAuth2Server

        public OAuth2Server​(CallbackHandler callbackHandler,
                            Map<String,​?> serverConfig,
                            ElytronMessages log)
        Constructs a new OAuth2Server instance.
        Parameters:
        callbackHandler - the callback handler for verifying the Bearer token.
        serverConfig - the server configuration.
        log - the logger to use.
    • Method Detail

      • evaluateInitialResponse

        public byte[] evaluateInitialResponse​(OAuth2InitialClientMessage initialClientMessage)
                                       throws AuthenticationMechanismException
        Evaluates the initial response sent by the client and verifies if the Bearer token is valid. If so, authorizes the user.
        Parameters:
        initialClientMessage - the initial client's message containing the Bearer token.
        Returns:
        an empty byte array if the token was authorized, error message otherwise.
        Throws:
        AuthenticationMechanismException - if an error occurs during the evaluation or the message doesn't contain the Bearer token.