Class AuthnActionSpec<ModelType>
- java.lang.Object
-
- com.pingidentity.sdk.api.authn.spec.AuthnActionSpec<ModelType>
-
- Type Parameters:
ModelType- The type for the model associated with the action (or Void if no model is associated with the action).
public class AuthnActionSpec<ModelType> extends Object
A class which acts as a template forAuthnActioninstances. This allows common definitions for authentication flow actions to be shared across plugins. This class is also used to generate documentation for a plugin's API. Once created, objects of this class are immutable. Objects of this class are not normally returned in API responses. Instead, you create anAuthnActioninstance using themakeInstance()method.- Since:
- 9.3
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAuthnActionSpec.Builder<ModelType>A fluent builder forAuthnActionSpecspecs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ModelTypedeserializeModel(javax.servlet.http.HttpServletRequest request)Deserialize the JSON body of an API request into an instance of the model for this action.StringgetDescription()Gets the description of this action for API documentation.List<AuthnErrorGroup>getErrorGroups()Get a list of errors that can be returned when this action is requested.StringgetId()Get the ID of the action.Class<ModelType>getModelClass()Gets the class of the model associated with this action, if there is one.booleanisRequested(javax.servlet.http.HttpServletRequest req)Determine if this action has been requested, based on the content type of the request.AuthnActionmakeInstance()Create a newAuthnActioninstance based on this spec.<ValueType>
ParamMapping<ModelType,ValueType>makeParamMapping(String formParamName, Function<ModelType,ValueType> modelFieldRetriever, Function<String,ValueType> paramFieldRetriever)Create a new param mapping from this action spec.
-
-
-
Method Detail
-
getId
public String getId()
Get the ID of the action. The Content-Type for the action is constructed from this by prepending "application/vnd.pingidentity." and appending "+json".
-
getDescription
public String getDescription()
Gets the description of this action for API documentation.
-
getModelClass
public Class<ModelType> getModelClass()
Gets the class of the model associated with this action, if there is one.
-
getErrorGroups
public List<AuthnErrorGroup> getErrorGroups()
Get a list of errors that can be returned when this action is requested. This method is used for generating API documentation for the action.
-
makeInstance
public AuthnAction makeInstance()
Create a newAuthnActioninstance based on this spec.- Returns:
- A new action instance.
-
makeParamMapping
public <ValueType> ParamMapping<ModelType,ValueType> makeParamMapping(String formParamName, Function<ModelType,ValueType> modelFieldRetriever, Function<String,ValueType> paramFieldRetriever)
Create a new param mapping from this action spec.- Parameters:
formParamName- The name of the form parameter.modelFieldRetriever- A function for retrieving the value of this field from an instance of the action's model.paramFieldRetriever- A function for retrieving the value of this field from the servlet request's parameter- Returns:
- The resulting param mapping.
-
isRequested
public boolean isRequested(javax.servlet.http.HttpServletRequest req)
Determine if this action has been requested, based on the content type of the request.- Parameters:
req- The servlet request.- Returns:
- True if req is an API request and this action was requested.
-
deserializeModel
public ModelType deserializeModel(javax.servlet.http.HttpServletRequest request) throws AuthnErrorException, IOException
Deserialize the JSON body of an API request into an instance of the model for this action.- Parameters:
request- The servlet request.- Returns:
- An instance of the model for this action.
- Throws:
AuthnErrorException- If an error occurred during validation of the JSON body against the expected API model classIOException- If an error occurred while attempting to deserialize the request.- Since:
- 10.1
-
-