Follow this pattern in lookupAuthN():

  1. Check for the possible actions the adapter expects in the current state.
  2. If an action is matched, then try to extract the expected model from the request and handle the action.
  3. If an action is requested, but it does not match an action allowed for the current state, then return an INVALID_ACTION_ID error.
  4. 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();