Class OAuth2Client
java.lang.Object
org.wildfly.security.mechanism.oauth2.OAuth2Client
Implementation of the client side of the OAuth2 SASL mechanism.
- Author:
- Pedro Igor
-
Constructor Summary
ConstructorsConstructorDescriptionOAuth2Client(String authorizationId, CallbackHandler callbackHandler, ElytronMessages log) Constructs a newOAuth2Clientinstance. -
Method Summary
Modifier and TypeMethodDescriptionGets the initial response message from the client that will be sent to the server.byte[]handleServerResponse(byte[] serverMessage) Handles the server's response to the initial client message.
-
Constructor Details
-
OAuth2Client
Constructs a newOAuth2Clientinstance.- Parameters:
authorizationId- the ID of the user to be authorized.callbackHandler- the callback handler for verifying the Bearer token.log- the logger to use.
-
-
Method Details
-
getInitialResponse
Gets the initial response message from the client that will be sent to the server. It retrieves the Bearer token from a callback and constructs an encoded message that includes the token.- Returns:
- encoded message that includes the Bearer token.
- Throws:
AuthenticationMechanismException- if an error occurs during the callback or the token isnull.
-
handleServerResponse
public byte[] handleServerResponse(byte[] serverMessage) Handles the server's response to the initial client message.- Parameters:
serverMessage- the byte array containing the server's response.- Returns:
nullif the response was successful, aborting the authentication otherwise.
-