Runtime behavior implementation
After you specify your plugin’s API at least partially, you can start implementing the runtime behavior. Use the specification that you defined previously to implement the runtime functionality.
Follow this pattern in lookupAuthN()
:
-
Check for the possible actions the adapter expects in the current state.
-
If an action is matched, then try to extract the expected model from the request and handle the action.
-
If an action is requested, but it does not match an action allowed for the current state, then return an
INVALID_ACTION_ID
error. -
If no action is requested, render the response for the current state.
The AuthnApiSupport
class provides much of the functionality for handling API requests and sending responses. The TemplateRenderAdapter
stores a reference to this singleton in its apiSupport
field.
private AuthnApiSupport apiSupport = AuthnApiSupport.getDefault();