Package org.keycloak.authentication
Class AuthenticationProcessor.Result
- java.lang.Object
- 
- org.keycloak.authentication.AuthenticationProcessor.Result
 
- 
- All Implemented Interfaces:
- AbstractAuthenticationFlowContext,- AuthenticationFlowContext,- ClientAuthenticationFlowContext
 - Enclosing class:
- AuthenticationProcessor
 
 public class AuthenticationProcessor.Result extends Object implements AuthenticationFlowContext, ClientAuthenticationFlowContext 
- 
- 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachUserSession(UserSessionModel userSession)voidattempted()There was no failure or challenge.voidcancelLogin()End the flow and redirect browser based on protocol specific respones.voidchallenge(javax.ws.rs.core.Response challenge)Sends a challenge response back to the HTTP client.voidclearUser()Clear the user from the flow.voidfailure(AuthenticationFlowError error)Aborts the current flowvoidfailure(AuthenticationFlowError error, javax.ws.rs.core.Response challenge)Aborts the current flow.voidfailure(AuthenticationFlowError error, javax.ws.rs.core.Response challenge, String eventDetails, String userErrorMessage)Aborts the current flow.voidfailureChallenge(AuthenticationFlowError error, javax.ws.rs.core.Response challenge)Same behavior as forceChallenge(), but the error count in brute force attack detection will be incremented.voidforceChallenge(javax.ws.rs.core.Response challenge)Sends the challenge back to the HTTP client irregardless of the current executionr requirementvoidfork()Fork the current flow.voidforkWithErrorMessage(FormMessage message)Fork the current flow.voidforkWithSuccessMessage(FormMessage message)Fork the current flow.LoginFormsProviderform()Create a Freemarker form builder that presets the user, action URI, and a generated access codeStringgenerateAccessCode()Generates access code and updates clientsession timestamp Access codes must be included in form action callbacks as a query parameter.URIgetActionTokenUrl(String tokenString)Get the action URL for the action token executor.URIgetActionUrl(String code)Get the action URL for the required action.List<AuthenticationSelectionOption>getAuthenticationSelections()AuthenticationSessionModelgetAuthenticationSession()AuthenticationSessionModel attached to this flowAuthenticatorgetAuthenticator()AuthenticatorConfigModelgetAuthenticatorConfig()Get any configuration associated with the current executionAuthenticationExecutionModel.RequirementgetCategoryRequirementFromCurrentFlow(String authenticatorCategory)javax.ws.rs.core.ResponsegetChallenge()ClientModelgetClient()Current client attached to this flow.Map<String,String>getClientAuthAttributes()Return the map where the authenticators can put some additional state related to authenticated client and the context how was client authenticated (ie.ClientAuthenticatorgetClientAuthenticator()ClientConnectiongetConnection()Information about the IP address from the connecting HTTP client.AuthenticationFlowErrorgetError()Get the error condition of a failed execution.FormMessagegetErrorMessage()EventBuildergetEvent()Current event builder being usedStringgetEventDetails()Get details of the event that caused an errorAuthenticationExecutionModelgetExecution()The current execution in the flowStringgetFlowPath()FormMessagegetForwardedErrorMessage()This could be an error message forwarded from another authenticator that is restarting or continuing the flo.FormMessagegetForwardedInfoMessage()This could be an info message forwarded from another authenticator.FormMessagegetForwardedSuccessMessage()This could be an success message forwarded from another authenticator that is restarting or continuing the flow.HttpRequestgetHttpRequest()BruteForceProtectorgetProtector()RealmModelgetRealm()Current realmURIgetRefreshExecutionUrl()Get the refresh URL for the required action.URIgetRefreshUrl(boolean authSessionIdParam)Get the refresh URL for the flow.KeycloakSessiongetSession()Current sessionFlowStatusgetStatus()Get the current status of the current execution.FormMessagegetSuccessMessage()javax.ws.rs.core.UriInfogetUriInfo()UriInfo of the current requestUserModelgetUser()Current user attached to this flow.StringgetUserErrorMessage()A custom error message that can be displayed to the userEventBuildernewEvent()Create a refresh new EventBuilder to use within this contextvoidresetFlow()Reset the current flow to the beginning and restarts it.voidresetFlow(Runnable afterResetListener)Reset the current flow to the beginning and restarts it.voidsetAuthenticationSelections(List<AuthenticationSelectionOption> authenticationSelections)voidsetClient(ClientModel client)Attach a specific client to this flow.voidsetForwardedInfoMessage(String message, Object... parameters)voidsetUser(UserModel user)Attach a specific user to this flow.voidsuccess()Mark the current execution as successful.
 
- 
- 
- 
Method Detail- 
newEventpublic EventBuilder newEvent() Description copied from interface:AbstractAuthenticationFlowContextCreate a refresh new EventBuilder to use within this context- Specified by:
- newEventin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getCategoryRequirementFromCurrentFlowpublic AuthenticationExecutionModel.Requirement getCategoryRequirementFromCurrentFlow(String authenticatorCategory) - Specified by:
- getCategoryRequirementFromCurrentFlowin interface- AbstractAuthenticationFlowContext
 
 - 
getExecutionpublic AuthenticationExecutionModel getExecution() Description copied from interface:AbstractAuthenticationFlowContextThe current execution in the flow- Specified by:
- getExecutionin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getAuthenticatorConfigpublic AuthenticatorConfigModel getAuthenticatorConfig() Description copied from interface:AbstractAuthenticationFlowContextGet any configuration associated with the current execution- Specified by:
- getAuthenticatorConfigin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getAuthenticatorpublic Authenticator getAuthenticator() 
 - 
getStatuspublic FlowStatus getStatus() Description copied from interface:AbstractAuthenticationFlowContextGet the current status of the current execution.- Specified by:
- getStatusin interface- AbstractAuthenticationFlowContext
- Returns:
- may return null if not set yet.
 
 - 
getClientAuthenticatorpublic ClientAuthenticator getClientAuthenticator() 
 - 
successpublic void success() Description copied from interface:AbstractAuthenticationFlowContextMark the current execution as successful. The flow will then continue- Specified by:
- successin interface- AbstractAuthenticationFlowContext
 
 - 
failurepublic void failure(AuthenticationFlowError error) Description copied from interface:AbstractAuthenticationFlowContextAborts the current flow- Specified by:
- failurein interface- AbstractAuthenticationFlowContext
 
 - 
challengepublic void challenge(javax.ws.rs.core.Response challenge) Description copied from interface:AbstractAuthenticationFlowContextSends a challenge response back to the HTTP client. If the current execution requirement is optional, this response will not be sent. If the current execution requirement is alternative, then this challenge will be sent if no other alternative execution was successful.- Specified by:
- challengein interface- AbstractAuthenticationFlowContext
 
 - 
forceChallengepublic void forceChallenge(javax.ws.rs.core.Response challenge) Description copied from interface:AbstractAuthenticationFlowContextSends the challenge back to the HTTP client irregardless of the current executionr requirement- Specified by:
- forceChallengein interface- AbstractAuthenticationFlowContext
 
 - 
failureChallengepublic void failureChallenge(AuthenticationFlowError error, javax.ws.rs.core.Response challenge) Description copied from interface:AbstractAuthenticationFlowContextSame behavior as forceChallenge(), but the error count in brute force attack detection will be incremented. For example, if a user enters in a bad password, the user is directed to try again, but Keycloak will keep track of how many failures have happened.- Specified by:
- failureChallengein interface- AbstractAuthenticationFlowContext
 
 - 
failurepublic void failure(AuthenticationFlowError error, javax.ws.rs.core.Response challenge) Description copied from interface:AbstractAuthenticationFlowContextAborts the current flow.- Specified by:
- failurein interface- AbstractAuthenticationFlowContext
- challenge- Response that will be sent back to HTTP client
 
 - 
failurepublic void failure(AuthenticationFlowError error, javax.ws.rs.core.Response challenge, String eventDetails, String userErrorMessage) Description copied from interface:AbstractAuthenticationFlowContextAborts the current flow.- Specified by:
- failurein interface- AbstractAuthenticationFlowContext
- challenge- Response that will be sent back to HTTP client
- eventDetails- Details about the error event
- userErrorMessage- A message describing the error to the user
 
 - 
attemptedpublic void attempted() Description copied from interface:AbstractAuthenticationFlowContextThere was no failure or challenge. The authenticator was attempted, but not fulfilled. If the current execution requirement is alternative or optional, then this status is ignored by the flow.- Specified by:
- attemptedin interface- AbstractAuthenticationFlowContext
 
 - 
getUserpublic UserModel getUser() Description copied from interface:AuthenticationFlowContextCurrent user attached to this flow. It can return null if no user has been identified yet- Specified by:
- getUserin interface- AuthenticationFlowContext
- Returns:
 
 - 
setUserpublic void setUser(UserModel user) Description copied from interface:AuthenticationFlowContextAttach a specific user to this flow.- Specified by:
- setUserin interface- AuthenticationFlowContext
 
 - 
getAuthenticationSelectionspublic List<AuthenticationSelectionOption> getAuthenticationSelections() - Specified by:
- getAuthenticationSelectionsin interface- AuthenticationFlowContext
 
 - 
setAuthenticationSelectionspublic void setAuthenticationSelections(List<AuthenticationSelectionOption> authenticationSelections) - Specified by:
- setAuthenticationSelectionsin interface- AuthenticationFlowContext
 
 - 
clearUserpublic void clearUser() Description copied from interface:AuthenticationFlowContextClear the user from the flow.- Specified by:
- clearUserin interface- AuthenticationFlowContext
 
 - 
getRealmpublic RealmModel getRealm() Description copied from interface:AbstractAuthenticationFlowContextCurrent realm- Specified by:
- getRealmin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getClientpublic ClientModel getClient() Description copied from interface:ClientAuthenticationFlowContextCurrent client attached to this flow. It can return null if no client has been identified yet- Specified by:
- getClientin interface- ClientAuthenticationFlowContext
- Returns:
 
 - 
setClientpublic void setClient(ClientModel client) Description copied from interface:ClientAuthenticationFlowContextAttach a specific client to this flow.- Specified by:
- setClientin interface- ClientAuthenticationFlowContext
 
 - 
getClientAuthAttributespublic Map<String,String> getClientAuthAttributes() Description copied from interface:ClientAuthenticationFlowContextReturn the map where the authenticators can put some additional state related to authenticated client and the context how was client authenticated (ie. attributes from client certificate etc). Map is writable, so you can add/remove items from it as needed. After successful authentication will be those state data put into UserSession notes. This allows you to configure UserSessionNote protocol mapper for your client, which will allow to map those state data into the access token available in the application- Specified by:
- getClientAuthAttributesin interface- ClientAuthenticationFlowContext
- Returns:
 
 - 
getAuthenticationSessionpublic AuthenticationSessionModel getAuthenticationSession() Description copied from interface:AuthenticationFlowContextAuthenticationSessionModel attached to this flow- Specified by:
- getAuthenticationSessionin interface- AuthenticationFlowContext
- Returns:
 
 - 
getFlowPathpublic String getFlowPath() - Specified by:
- getFlowPathin interface- AuthenticationFlowContext
- Returns:
- current flow path (EG. authenticate, reset-credentials)
 
 - 
getConnectionpublic ClientConnection getConnection() Description copied from interface:AbstractAuthenticationFlowContextInformation about the IP address from the connecting HTTP client.- Specified by:
- getConnectionin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getUriInfopublic javax.ws.rs.core.UriInfo getUriInfo() Description copied from interface:AbstractAuthenticationFlowContextUriInfo of the current request- Specified by:
- getUriInfoin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getSessionpublic KeycloakSession getSession() Description copied from interface:AbstractAuthenticationFlowContextCurrent session- Specified by:
- getSessionin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getHttpRequestpublic HttpRequest getHttpRequest() - Specified by:
- getHttpRequestin interface- AbstractAuthenticationFlowContext
 
 - 
attachUserSessionpublic void attachUserSession(UserSessionModel userSession) - Specified by:
- attachUserSessionin interface- AuthenticationFlowContext
 
 - 
getProtectorpublic BruteForceProtector getProtector() - Specified by:
- getProtectorin interface- AbstractAuthenticationFlowContext
 
 - 
getEventpublic EventBuilder getEvent() Description copied from interface:AbstractAuthenticationFlowContextCurrent event builder being used- Specified by:
- getEventin interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getForwardedErrorMessagepublic FormMessage getForwardedErrorMessage() Description copied from interface:AbstractAuthenticationFlowContextThis could be an error message forwarded from another authenticator that is restarting or continuing the flo. For example the brokering API sends this when the broker failed authentication and we want to continue authentication locally. forwardedErrorMessage can then be displayed by whatever form is challenging.- Specified by:
- getForwardedErrorMessagein interface- AbstractAuthenticationFlowContext
 
 - 
generateAccessCodepublic String generateAccessCode() Description copied from interface:AbstractAuthenticationFlowContextGenerates access code and updates clientsession timestamp Access codes must be included in form action callbacks as a query parameter.- Specified by:
- generateAccessCodein interface- AbstractAuthenticationFlowContext
- Returns:
 
 - 
getChallengepublic javax.ws.rs.core.Response getChallenge() 
 - 
getErrorpublic AuthenticationFlowError getError() Description copied from interface:AbstractAuthenticationFlowContextGet the error condition of a failed execution.- Specified by:
- getErrorin interface- AbstractAuthenticationFlowContext
- Returns:
- may return null if there was no error
 
 - 
formpublic LoginFormsProvider form() Description copied from interface:AuthenticationFlowContextCreate a Freemarker form builder that presets the user, action URI, and a generated access code- Specified by:
- formin interface- AuthenticationFlowContext
- Returns:
 
 - 
getActionUrlpublic URI getActionUrl(String code) Description copied from interface:AuthenticationFlowContextGet the action URL for the required action.- Specified by:
- getActionUrlin interface- AuthenticationFlowContext
- Parameters:
- code- authentication session access code
- Returns:
 
 - 
getActionTokenUrlpublic URI getActionTokenUrl(String tokenString) Description copied from interface:AuthenticationFlowContextGet the action URL for the action token executor.- Specified by:
- getActionTokenUrlin interface- AuthenticationFlowContext
- Parameters:
- tokenString- String representation (JWT) of action token
- Returns:
 
 - 
getRefreshExecutionUrlpublic URI getRefreshExecutionUrl() Description copied from interface:AuthenticationFlowContextGet the refresh URL for the required action.- Specified by:
- getRefreshExecutionUrlin interface- AuthenticationFlowContext
- Returns:
 
 - 
getRefreshUrlpublic URI getRefreshUrl(boolean authSessionIdParam) Description copied from interface:AuthenticationFlowContextGet the refresh URL for the flow.- Specified by:
- getRefreshUrlin interface- AuthenticationFlowContext
- Parameters:
- authSessionIdParam- will include auth_session query param for clients that don't process cookies
- Returns:
 
 - 
cancelLoginpublic void cancelLogin() Description copied from interface:AuthenticationFlowContextEnd the flow and redirect browser based on protocol specific respones. This should only be executed in browser-based flows.- Specified by:
- cancelLoginin interface- AuthenticationFlowContext
 
 - 
resetFlowpublic void resetFlow() Description copied from interface:AuthenticationFlowContextReset the current flow to the beginning and restarts it.- Specified by:
- resetFlowin interface- AuthenticationFlowContext
 
 - 
resetFlowpublic void resetFlow(Runnable afterResetListener) Description copied from interface:AuthenticationFlowContextReset the current flow to the beginning and restarts it. Allows to add additional listener, which is triggered after flow restarted- Specified by:
- resetFlowin interface- AuthenticationFlowContext
 
 - 
forkpublic void fork() Description copied from interface:AuthenticationFlowContextFork the current flow. The authentication session will be cloned and set to point at the realm's browser login flow. The Response will be the result of this fork. The previous flow will still be set at the current execution. This is used by reset password when it sends an email. It sends an email linking to the current flow and redirects the browser to a new browser login flow.- Specified by:
- forkin interface- AuthenticationFlowContext
 
 - 
forkWithSuccessMessagepublic void forkWithSuccessMessage(FormMessage message) Description copied from interface:AuthenticationFlowContextFork the current flow. The authentication session will be cloned and set to point at the realm's browser login flow. The Response will be the result of this fork. The previous flow will still be set at the current execution. This is used by reset password when it sends an email. It sends an email linking to the current flow and redirects the browser to a new browser login flow. This method will set up a success message that will be displayed in the first page of the new flow- Specified by:
- forkWithSuccessMessagein interface- AuthenticationFlowContext
- Parameters:
- message- Corresponds to raw text or a message property defined in a message bundle
 
 - 
forkWithErrorMessagepublic void forkWithErrorMessage(FormMessage message) Description copied from interface:AuthenticationFlowContextFork the current flow. The authentication session will be cloned and set to point at the realm's browser login flow. The Response will be the result of this fork. The previous flow will still be set at the current execution. This is used by reset password when it sends an email. It sends an email linking to the current flow and redirects the browser to a new browser login flow. This method will set up an error message that will be displayed in the first page of the new flow- Specified by:
- forkWithErrorMessagein interface- AuthenticationFlowContext
- Parameters:
- message- Corresponds to raw text or a message property defined in a message bundle
 
 - 
getForwardedSuccessMessagepublic FormMessage getForwardedSuccessMessage() Description copied from interface:AbstractAuthenticationFlowContextThis could be an success message forwarded from another authenticator that is restarting or continuing the flow. For example a reset password sends an email, then resets the flow with a success message. forwardedSuccessMessage can then be displayed by whatever form is challenging.- Specified by:
- getForwardedSuccessMessagein interface- AbstractAuthenticationFlowContext
 
 - 
setForwardedInfoMessagepublic void setForwardedInfoMessage(String message, Object... parameters) - Specified by:
- setForwardedInfoMessagein interface- AbstractAuthenticationFlowContext
- Parameters:
- message- to be forwarded
- parameters- parameters of the message if any
- See Also:
- AbstractAuthenticationFlowContext.getForwardedInfoMessage()
 
 - 
getForwardedInfoMessagepublic FormMessage getForwardedInfoMessage() Description copied from interface:AbstractAuthenticationFlowContextThis could be an info message forwarded from another authenticator. This info message will be usually displayed only once on the first screen shown to the user during authentication. The authenticator forwarding the info message does not know which the screen would be. For example during user re-authentication, the user should see info message like "Please re-authenticate", but at the beginning of the authentication, it is not 100% clear which screen will be the first shown screen where this message should be displayed- Specified by:
- getForwardedInfoMessagein interface- AbstractAuthenticationFlowContext
 
 - 
getErrorMessagepublic FormMessage getErrorMessage() 
 - 
getSuccessMessagepublic FormMessage getSuccessMessage() 
 - 
getEventDetailspublic String getEventDetails() Description copied from interface:AbstractAuthenticationFlowContextGet details of the event that caused an error- Specified by:
- getEventDetailsin interface- AbstractAuthenticationFlowContext
- Returns:
- may return null if not set
 
 - 
getUserErrorMessagepublic String getUserErrorMessage() Description copied from interface:AbstractAuthenticationFlowContextA custom error message that can be displayed to the user- Specified by:
- getUserErrorMessagein interface- AbstractAuthenticationFlowContext
- Returns:
- Optional error message
 
 
- 
 
-