Class OAuth2Server
java.lang.Object
org.wildfly.security.mechanism.oauth2.OAuth2Server
An OAuth2 Server based on RFC-7628.
- Author:
- Pedro Igor
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOAuth2Server(CallbackHandler callbackHandler, Map<String, ?> serverConfig, ElytronMessages log) Constructs a newOAuth2Serverinstance. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]evaluateInitialResponse(OAuth2InitialClientMessage initialClientMessage) Evaluates the initial response sent by the client and verifies if the Bearer token is valid.parseInitialClientMessage(byte[] fromBytes) Parses the initial client's message in OAuth2 protocol.
-
Field Details
-
CONFIG_OPENID_CONFIGURATION_URL
- See Also:
-
-
Constructor Details
-
OAuth2Server
public OAuth2Server(CallbackHandler callbackHandler, Map<String, ?> serverConfig, ElytronMessages log) Constructs a newOAuth2Serverinstance.- 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.
-