Class OAuth2Server

java.lang.Object
org.wildfly.security.mechanism.oauth2.OAuth2Server

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

  • Constructor Details

    • 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 Details

    • parseInitialClientMessage

      public OAuth2InitialClientMessage parseInitialClientMessage(byte[] fromBytes) throws AuthenticationMechanismException
      Parses the initial client's message in OAuth2 protocol.
      Parameters:
      fromBytes - the initial client's message.
      Returns:
      parsed client's message.
      Throws:
      AuthenticationMechanismException - if an error occurs during the parsing or the message is invalid.
    • 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.