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 Summary
Fields Modifier and Type Field Description static StringCONFIG_OPENID_CONFIGURATION_URL
-
Constructor Summary
Constructors Constructor Description OAuth2Server(CallbackHandler callbackHandler, Map<String,?> serverConfig, ElytronMessages log)Constructs a newOAuth2Serverinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]evaluateInitialResponse(OAuth2InitialClientMessage initialClientMessage)Evaluates the initial response sent by the client and verifies if the Bearer token is valid.OAuth2InitialClientMessageparseInitialClientMessage(byte[] fromBytes)Parses the initial client's message in OAuth2 protocol.
-
-
-
Field Detail
-
CONFIG_OPENID_CONFIGURATION_URL
public static final String CONFIG_OPENID_CONFIGURATION_URL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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.
-
-