Class RestAuthCallbackHandlerManager
- java.lang.Object
-
- org.forgerock.openam.core.rest.authn.RestAuthCallbackHandlerManager
-
public class RestAuthCallbackHandlerManager extends Object
Manages the converting of Callbacks to and from JSON representation.
-
-
Constructor Summary
Constructors Constructor Description RestAuthCallbackHandlerManager(RestAuthCallbackHandlerFactory restAuthCallbackHandlerFactory)Constructs an instance of the RestAuthCallbackHandlerManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.forgerock.json.JsonValuehandleCallbacks(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Callback[] callbacks)Handles Callbacks by either updating them with their required values from the headers and request or converting them to JSON representations to be sent back to the client.Callback[]handleJsonCallbacks(Callback[] originalCallbacks, org.forgerock.json.JsonValue jsonCallbacks)Handles the JSON representations of Callbacks, converting them back to Callbacks by setting the values from the JSONArray to the original Callbacks passed in.Callback[]handleResponseCallbacks(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Callback[] originalCallbacks, org.forgerock.json.JsonValue jsonRequestObject)Handles the processing of the JSON given in the request and updates the Callback objects from it.
-
-
-
Constructor Detail
-
RestAuthCallbackHandlerManager
@Inject public RestAuthCallbackHandlerManager(RestAuthCallbackHandlerFactory restAuthCallbackHandlerFactory)
Constructs an instance of the RestAuthCallbackHandlerManager.- Parameters:
restAuthCallbackHandlerFactory- An instance of the RestAuthCallbackHandlerFactory.
-
-
Method Detail
-
handleCallbacks
public org.forgerock.json.JsonValue handleCallbacks(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Callback[] callbacks) throws RestAuthExceptionHandles Callbacks by either updating them with their required values from the headers and request or converting them to JSON representations to be sent back to the client.- Parameters:
request- The HttpServletRequest from the request.response- The HttpServletResponse from the request.callbacks- The Callbacks to handle.- Returns:
- A JSONArray of Callbacks or empty if the Callbacks have been updated from the headers and request.
- Throws:
RestAuthException
-
handleJsonCallbacks
public Callback[] handleJsonCallbacks(Callback[] originalCallbacks, org.forgerock.json.JsonValue jsonCallbacks) throws RestAuthException
Handles the JSON representations of Callbacks, converting them back to Callbacks by setting the values from the JSONArray to the original Callbacks passed in. The method sets the appropriate values on the Callbacks parameter and returns the same Callbacks parameter. This is required because of the way the AuthContext handles submitting requirements (Callbacks). The JSON callbacks array must be in the same order as it was sent it, so it matches the order of the Callback object array.- Parameters:
originalCallbacks- The Callbacks to set values from the JSONArray onto.jsonCallbacks- The JSON representation of the Callbacks.- Returns:
- The same Callbacks as in the parameters with the required values set.
- Throws:
RestAuthException
-
handleResponseCallbacks
public Callback[] handleResponseCallbacks(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Callback[] originalCallbacks, org.forgerock.json.JsonValue jsonRequestObject) throws RestAuthException
Handles the processing of the JSON given in the request and updates the Callback objects from it. This is for special circumstances where the JSON from the request does not contain a "callback" attribute, where thehandleJsonCallbacks()method should be used.- Parameters:
request- The HttpServletRequest from the request.response- The HttpServletResponse from the request.originalCallbacks- The Callbacks to set values from the JSONArray onto.jsonRequestObject- The JSON object that was sent in the POST of the request.- Returns:
- The updated originalCallbacks.
- Throws:
RestAuthException
-
-