keycloak-scim/services/src/main/java/org/keycloak/authentication/RequiredActionContext.java

119 lines
2.6 KiB
Java
Raw Normal View History

package org.keycloak.authentication;
import org.jboss.resteasy.spi.HttpRequest;
import org.keycloak.ClientConnection;
import org.keycloak.events.EventBuilder;
2015-08-13 15:28:11 +00:00
import org.keycloak.login.LoginFormsProvider;
import org.keycloak.models.ClientSessionModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.UserSessionModel;
2015-08-11 17:04:40 +00:00
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
2015-08-13 15:28:11 +00:00
import java.net.URI;
/**
2015-08-09 19:06:24 +00:00
* Interface that encapsulates current information about the current requred action
*
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public interface RequiredActionContext {
2015-08-11 17:04:40 +00:00
public static enum Status {
CHALLENGE,
SUCCESS,
IGNORE,
FAILURE
}
2015-08-13 15:28:11 +00:00
/**
* Get the action URL for the required action.
*
* @param code client sessino access code
* @return
*/
URI getActionUrl(String code);
/**
* Get the action URL for the required action. This auto-generates the access code.
*
* @return
*/
URI getActionUrl();
/**
* Create a Freemarker form builder that presets the user, action URI, and a generated access code
*
* @return
*/
LoginFormsProvider form();
/**
* If challenge has been sent this returns the JAX-RS Response
*
* @return
*/
Response getChallenge();
2015-08-09 19:06:24 +00:00
/**
* Current event builder being used
*
* @return
*/
EventBuilder getEvent();
2015-08-09 19:06:24 +00:00
/**
* Current user
*
* @return
*/
UserModel getUser();
RealmModel getRealm();
ClientSessionModel getClientSession();
UserSessionModel getUserSession();
ClientConnection getConnection();
UriInfo getUriInfo();
KeycloakSession getSession();
HttpRequest getHttpRequest();
2015-08-09 19:06:24 +00:00
/**
* Generates access code and updates clientsession timestamp
* Access codes must be included in form action callbacks as a query parameter.
*
* @return
*/
2015-10-15 20:30:21 +00:00
String generateCode();
2015-08-11 17:04:40 +00:00
Status getStatus();
2015-08-13 15:28:11 +00:00
/**
* Send a challenge Response back to user
*
* @param response
*/
2015-08-11 17:04:40 +00:00
void challenge(Response response);
2015-08-13 15:28:11 +00:00
/**
* Abort the authentication with an error
*
*/
2015-08-11 17:04:40 +00:00
void failure();
2015-08-13 15:28:11 +00:00
/**
* Mark this required action as successful. The required action will be removed from the UserModel
*
*/
2015-08-11 17:04:40 +00:00
void success();
2015-08-13 15:28:11 +00:00
/**
* Ignore this required action and go onto the next, or complete the flow.
*
*/
void ignore();
}