2015-08-09 19:06:24 +00:00
|
|
|
package org.keycloak.authentication;
|
|
|
|
|
2015-08-13 15:28:11 +00:00
|
|
|
import org.keycloak.login.LoginFormsProvider;
|
2015-08-09 19:06:24 +00:00
|
|
|
import org.keycloak.models.ClientSessionModel;
|
|
|
|
import org.keycloak.models.UserModel;
|
|
|
|
import org.keycloak.models.UserSessionModel;
|
2015-08-20 21:43:37 +00:00
|
|
|
import org.keycloak.models.utils.FormMessage;
|
|
|
|
|
2015-08-13 15:28:11 +00:00
|
|
|
import java.net.URI;
|
2015-08-09 19:06:24 +00:00
|
|
|
|
|
|
|
/**
|
2015-08-11 17:04:40 +00:00
|
|
|
* This interface encapsulates information about an execution in an AuthenticationFlow. It is also used to set
|
|
|
|
* the status of the execution being performed.
|
|
|
|
*
|
|
|
|
*
|
2015-08-09 19:06:24 +00:00
|
|
|
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
|
|
|
|
* @version $Revision: 1 $
|
|
|
|
*/
|
2015-08-12 16:52:13 +00:00
|
|
|
public interface AuthenticationFlowContext extends AbstractAuthenticationFlowContext {
|
2015-08-09 19:06:24 +00:00
|
|
|
|
|
|
|
/**
|
2015-08-12 16:52:13 +00:00
|
|
|
* Current user attached to this flow. It can return null if no user has been identified yet
|
2015-08-09 19:06:24 +00:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
UserModel getUser();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Attach a specific user to this flow.
|
|
|
|
*
|
|
|
|
* @param user
|
|
|
|
*/
|
|
|
|
void setUser(UserModel user);
|
|
|
|
|
2015-10-16 09:23:54 +00:00
|
|
|
/**
|
|
|
|
* Clear the user from the flow.
|
|
|
|
*/
|
|
|
|
void clearUser();
|
|
|
|
|
2015-08-09 19:06:24 +00:00
|
|
|
void attachUserSession(UserSessionModel userSession);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* ClientSessionModel attached to this flow
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
ClientSessionModel getClientSession();
|
|
|
|
|
2015-08-13 15:28:11 +00:00
|
|
|
/**
|
|
|
|
* Create a Freemarker form builder that presets the user, action URI, and a generated access code
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
LoginFormsProvider form();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the action URL for the required action.
|
|
|
|
*
|
|
|
|
* @param code client session access code
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
URI getActionUrl(String code);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the action URL for the required action. This auto-generates the access code.
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
URI getActionUrl();
|
2015-08-14 18:38:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* End the flow and redirect browser based on protocol specific respones. This should only be executed
|
|
|
|
* in browser-based flows.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void cancelLogin();
|
2015-08-16 19:20:16 +00:00
|
|
|
|
2015-10-14 15:49:36 +00:00
|
|
|
/**
|
|
|
|
* Reset the current flow to the beginning and restarts it.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void resetFlow();
|
|
|
|
|
2015-08-16 19:20:16 +00:00
|
|
|
/**
|
2015-08-20 21:43:37 +00:00
|
|
|
* Fork the current flow. The client 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.
|
|
|
|
*
|
|
|
|
*
|
2015-08-16 19:20:16 +00:00
|
|
|
*
|
|
|
|
* @return
|
|
|
|
*/
|
2015-08-20 21:43:37 +00:00
|
|
|
void fork();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fork the current flow. The client 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
|
|
|
|
*
|
|
|
|
* @param message Corresponds to raw text or a message property defined in a message bundle
|
|
|
|
*/
|
|
|
|
void forkWithSuccessMessage(FormMessage message);
|
|
|
|
/**
|
|
|
|
* Fork the current flow. The client 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
|
|
|
|
*
|
|
|
|
* @param message Corresponds to raw text or a message property defined in a message bundle
|
|
|
|
*/
|
|
|
|
void forkWithErrorMessage(FormMessage message);
|
2015-08-09 19:06:24 +00:00
|
|
|
}
|