refactor execution model
This commit is contained in:
parent
de940ccff9
commit
04d3d26cb1
26 changed files with 99 additions and 48 deletions
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||||
|
<changeSet author="bburke@redhat.com" id="1.5.0">
|
||||||
|
<delete tableName="CLIENT_SESSION_AUTH_STATUS"/>
|
||||||
|
<delete tableName="CLIENT_SESSION_ROLE"/>
|
||||||
|
<delete tableName="CLIENT_SESSION_PROT_MAPPER"/>
|
||||||
|
<delete tableName="CLIENT_SESSION_NOTE"/>
|
||||||
|
<delete tableName="CLIENT_SESSION"/>
|
||||||
|
<delete tableName="USER_SESSION_NOTE"/>
|
||||||
|
<delete tableName="USER_SESSION"/>
|
||||||
|
|
||||||
|
<dropColumn tableName="AUTHENTICATION_EXECUTION" columnName="USER_SETUP_ALLOWED"/>
|
||||||
|
</changeSet>
|
||||||
|
</databaseChangeLog>
|
|
@ -8,4 +8,5 @@
|
||||||
<include file="META-INF/jpa-changelog-1.2.0.Final.xml"/>
|
<include file="META-INF/jpa-changelog-1.2.0.Final.xml"/>
|
||||||
<include file="META-INF/jpa-changelog-1.3.0.xml"/>
|
<include file="META-INF/jpa-changelog-1.3.0.xml"/>
|
||||||
<include file="META-INF/jpa-changelog-1.4.0.xml"/>
|
<include file="META-INF/jpa-changelog-1.4.0.xml"/>
|
||||||
|
<include file="META-INF/jpa-changelog-1.5.0.xml"/>
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|
|
@ -12,7 +12,7 @@ public interface JpaUpdaterProvider extends Provider {
|
||||||
|
|
||||||
public String FIRST_VERSION = "1.0.0.Final";
|
public String FIRST_VERSION = "1.0.0.Final";
|
||||||
|
|
||||||
public String LAST_VERSION = "1.4.0";
|
public String LAST_VERSION = "1.5.0";
|
||||||
|
|
||||||
public String getCurrentVersionSql(String defaultSchema);
|
public String getCurrentVersionSql(String defaultSchema);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@ public class AuthenticationExecutionModel implements Serializable {
|
||||||
private String flowId;
|
private String flowId;
|
||||||
private boolean authenticatorFlow;
|
private boolean authenticatorFlow;
|
||||||
private Requirement requirement;
|
private Requirement requirement;
|
||||||
private boolean userSetupAllowed;
|
|
||||||
private int priority;
|
private int priority;
|
||||||
private String parentFlow;
|
private String parentFlow;
|
||||||
|
|
||||||
|
@ -69,14 +68,6 @@ public class AuthenticationExecutionModel implements Serializable {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUserSetupAllowed() {
|
|
||||||
return userSetupAllowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserSetupAllowed(boolean userSetupAllowed) {
|
|
||||||
this.userSetupAllowed = userSetupAllowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getParentFlow() {
|
public String getParentFlow() {
|
||||||
return parentFlow;
|
return parentFlow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
||||||
execution.setAuthenticator("registration-page-form");
|
execution.setAuthenticator("registration-page-form");
|
||||||
execution.setPriority(10);
|
execution.setPriority(10);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(true);
|
execution.setAuthenticatorFlow(true);
|
||||||
execution.setFlowId(registrationFormFlow.getId());
|
execution.setFlowId(registrationFormFlow.getId());
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
@ -65,7 +64,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
||||||
execution.setAuthenticator("registration-user-creation");
|
execution.setAuthenticator("registration-user-creation");
|
||||||
execution.setPriority(20);
|
execution.setPriority(20);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -74,7 +72,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
||||||
execution.setAuthenticator("registration-profile-action");
|
execution.setAuthenticator("registration-profile-action");
|
||||||
execution.setPriority(40);
|
execution.setPriority(40);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -83,7 +80,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
||||||
execution.setAuthenticator("registration-password-action");
|
execution.setAuthenticator("registration-password-action");
|
||||||
execution.setPriority(50);
|
execution.setPriority(50);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -99,7 +95,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
|
||||||
execution.setAuthenticator("registration-recaptcha-action");
|
execution.setAuthenticator("registration-recaptcha-action");
|
||||||
execution.setPriority(60);
|
execution.setPriority(60);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
//execution.setAuthenticatorConfig(captchaConfig.getId());
|
//execution.setAuthenticatorConfig(captchaConfig.getId());
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
@ -137,7 +132,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
||||||
execution.setAuthenticator("direct-grant-validate-username");
|
execution.setAuthenticator("direct-grant-validate-username");
|
||||||
execution.setPriority(10);
|
execution.setPriority(10);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -150,7 +144,6 @@ public class DefaultAuthenticationFlows {
|
||||||
}
|
}
|
||||||
execution.setAuthenticator("direct-grant-validate-password");
|
execution.setAuthenticator("direct-grant-validate-password");
|
||||||
execution.setPriority(20);
|
execution.setPriority(20);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -163,7 +156,6 @@ public class DefaultAuthenticationFlows {
|
||||||
}
|
}
|
||||||
execution.setAuthenticator("direct-grant-validate-otp");
|
execution.setAuthenticator("direct-grant-validate-otp");
|
||||||
execution.setPriority(30);
|
execution.setPriority(30);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -184,7 +176,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
|
||||||
execution.setAuthenticator("auth-cookie");
|
execution.setAuthenticator("auth-cookie");
|
||||||
execution.setPriority(10);
|
execution.setPriority(10);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
execution = new AuthenticationExecutionModel();
|
execution = new AuthenticationExecutionModel();
|
||||||
|
@ -196,7 +187,6 @@ public class DefaultAuthenticationFlows {
|
||||||
}
|
}
|
||||||
execution.setAuthenticator("auth-spnego");
|
execution.setAuthenticator("auth-spnego");
|
||||||
execution.setPriority(20);
|
execution.setPriority(20);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -213,7 +203,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.ALTERNATIVE);
|
||||||
execution.setFlowId(forms.getId());
|
execution.setFlowId(forms.getId());
|
||||||
execution.setPriority(30);
|
execution.setPriority(30);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(true);
|
execution.setAuthenticatorFlow(true);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -224,7 +213,6 @@ public class DefaultAuthenticationFlows {
|
||||||
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
execution.setRequirement(AuthenticationExecutionModel.Requirement.REQUIRED);
|
||||||
execution.setAuthenticator("auth-username-password-form");
|
execution.setAuthenticator("auth-username-password-form");
|
||||||
execution.setPriority(10);
|
execution.setPriority(10);
|
||||||
execution.setUserSetupAllowed(false);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
|
|
||||||
|
@ -239,7 +227,6 @@ public class DefaultAuthenticationFlows {
|
||||||
|
|
||||||
execution.setAuthenticator("auth-otp-form");
|
execution.setAuthenticator("auth-otp-form");
|
||||||
execution.setPriority(20);
|
execution.setPriority(20);
|
||||||
execution.setUserSetupAllowed(true);
|
|
||||||
execution.setAuthenticatorFlow(false);
|
execution.setAuthenticatorFlow(false);
|
||||||
realm.addAuthenticatorExecution(execution);
|
realm.addAuthenticatorExecution(execution);
|
||||||
}
|
}
|
||||||
|
|
|
@ -468,7 +468,6 @@ public class ModelToRepresentation {
|
||||||
rep.setFlowAlias(flow.getAlias());
|
rep.setFlowAlias(flow.getAlias());
|
||||||
}
|
}
|
||||||
rep.setPriority(model.getPriority());
|
rep.setPriority(model.getPriority());
|
||||||
rep.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
rep.setRequirement(model.getRequirement().name());
|
rep.setRequirement(model.getRequirement().name());
|
||||||
return rep;
|
return rep;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1083,7 +1083,6 @@ public class RepresentationToModel {
|
||||||
model.setFlowId(flow.getId());
|
model.setFlowId(flow.getId());
|
||||||
}
|
}
|
||||||
model.setPriority(rep.getPriority());
|
model.setPriority(rep.getPriority());
|
||||||
model.setUserSetupAllowed(rep.isUserSetupAllowed());
|
|
||||||
model.setRequirement(AuthenticationExecutionModel.Requirement.valueOf(rep.getRequirement()));
|
model.setRequirement(AuthenticationExecutionModel.Requirement.valueOf(rep.getRequirement()));
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1308,7 +1308,6 @@ public class RealmAdapter implements RealmModel {
|
||||||
public AuthenticationExecutionModel entityToModel(AuthenticationExecutionEntity entity) {
|
public AuthenticationExecutionModel entityToModel(AuthenticationExecutionEntity entity) {
|
||||||
AuthenticationExecutionModel model = new AuthenticationExecutionModel();
|
AuthenticationExecutionModel model = new AuthenticationExecutionModel();
|
||||||
model.setId(entity.getId());
|
model.setId(entity.getId());
|
||||||
model.setUserSetupAllowed(entity.isUserSetupAllowed());
|
|
||||||
model.setRequirement(entity.getRequirement());
|
model.setRequirement(entity.getRequirement());
|
||||||
model.setPriority(entity.getPriority());
|
model.setPriority(entity.getPriority());
|
||||||
model.setAuthenticator(entity.getAuthenticator());
|
model.setAuthenticator(entity.getAuthenticator());
|
||||||
|
@ -1345,7 +1344,6 @@ public class RealmAdapter implements RealmModel {
|
||||||
entity.setAuthenticator(model.getAuthenticator());
|
entity.setAuthenticator(model.getAuthenticator());
|
||||||
entity.setPriority(model.getPriority());
|
entity.setPriority(model.getPriority());
|
||||||
entity.setRequirement(model.getRequirement());
|
entity.setRequirement(model.getRequirement());
|
||||||
entity.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
entity.setAuthenticatorFlow(model.isAuthenticatorFlow());
|
entity.setAuthenticatorFlow(model.isAuthenticatorFlow());
|
||||||
entity.setFlowId(model.getFlowId());
|
entity.setFlowId(model.getFlowId());
|
||||||
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
||||||
|
@ -1371,7 +1369,6 @@ public class RealmAdapter implements RealmModel {
|
||||||
entity.setPriority(model.getPriority());
|
entity.setPriority(model.getPriority());
|
||||||
entity.setRequirement(model.getRequirement());
|
entity.setRequirement(model.getRequirement());
|
||||||
entity.setFlowId(model.getFlowId());
|
entity.setFlowId(model.getFlowId());
|
||||||
entity.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1622,7 +1622,6 @@ public class RealmAdapter implements RealmModel {
|
||||||
public AuthenticationExecutionModel entityToModel(AuthenticationExecutionEntity entity) {
|
public AuthenticationExecutionModel entityToModel(AuthenticationExecutionEntity entity) {
|
||||||
AuthenticationExecutionModel model = new AuthenticationExecutionModel();
|
AuthenticationExecutionModel model = new AuthenticationExecutionModel();
|
||||||
model.setId(entity.getId());
|
model.setId(entity.getId());
|
||||||
model.setUserSetupAllowed(entity.isUserSetupAllowed());
|
|
||||||
model.setRequirement(entity.getRequirement());
|
model.setRequirement(entity.getRequirement());
|
||||||
model.setPriority(entity.getPriority());
|
model.setPriority(entity.getPriority());
|
||||||
model.setAuthenticator(entity.getAuthenticator());
|
model.setAuthenticator(entity.getAuthenticator());
|
||||||
|
@ -1654,7 +1653,6 @@ public class RealmAdapter implements RealmModel {
|
||||||
entity.setParentFlow(flow);
|
entity.setParentFlow(flow);
|
||||||
flow.getExecutions().add(entity);
|
flow.getExecutions().add(entity);
|
||||||
entity.setRealm(realm);
|
entity.setRealm(realm);
|
||||||
entity.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
entity.setAutheticatorFlow(model.isAuthenticatorFlow());
|
entity.setAutheticatorFlow(model.isAuthenticatorFlow());
|
||||||
em.persist(entity);
|
em.persist(entity);
|
||||||
em.flush();
|
em.flush();
|
||||||
|
@ -1671,7 +1669,6 @@ public class RealmAdapter implements RealmModel {
|
||||||
entity.setAuthenticator(model.getAuthenticator());
|
entity.setAuthenticator(model.getAuthenticator());
|
||||||
entity.setPriority(model.getPriority());
|
entity.setPriority(model.getPriority());
|
||||||
entity.setRequirement(model.getRequirement());
|
entity.setRequirement(model.getRequirement());
|
||||||
entity.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
||||||
entity.setFlowId(model.getFlowId());
|
entity.setFlowId(model.getFlowId());
|
||||||
em.flush();
|
em.flush();
|
||||||
|
|
|
@ -51,9 +51,6 @@ public class AuthenticationExecutionEntity {
|
||||||
@Column(name="PRIORITY")
|
@Column(name="PRIORITY")
|
||||||
protected int priority;
|
protected int priority;
|
||||||
|
|
||||||
@Column(name="USER_SETUP_ALLOWED")
|
|
||||||
private boolean userSetupAllowed;
|
|
||||||
|
|
||||||
@Column(name="AUTHENTICATOR_FLOW")
|
@Column(name="AUTHENTICATOR_FLOW")
|
||||||
private boolean autheticatorFlow;
|
private boolean autheticatorFlow;
|
||||||
|
|
||||||
|
@ -97,14 +94,6 @@ public class AuthenticationExecutionEntity {
|
||||||
this.priority = priority;
|
this.priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUserSetupAllowed() {
|
|
||||||
return userSetupAllowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUserSetupAllowed(boolean userSetupAllowed) {
|
|
||||||
this.userSetupAllowed = userSetupAllowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAutheticatorFlow() {
|
public boolean isAutheticatorFlow() {
|
||||||
return autheticatorFlow;
|
return autheticatorFlow;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1384,7 +1384,6 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
public AuthenticationExecutionModel entityToModel(AuthenticationExecutionEntity entity) {
|
public AuthenticationExecutionModel entityToModel(AuthenticationExecutionEntity entity) {
|
||||||
AuthenticationExecutionModel model = new AuthenticationExecutionModel();
|
AuthenticationExecutionModel model = new AuthenticationExecutionModel();
|
||||||
model.setId(entity.getId());
|
model.setId(entity.getId());
|
||||||
model.setUserSetupAllowed(entity.isUserSetupAllowed());
|
|
||||||
model.setRequirement(entity.getRequirement());
|
model.setRequirement(entity.getRequirement());
|
||||||
model.setPriority(entity.getPriority());
|
model.setPriority(entity.getPriority());
|
||||||
model.setAuthenticator(entity.getAuthenticator());
|
model.setAuthenticator(entity.getAuthenticator());
|
||||||
|
@ -1421,7 +1420,6 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
entity.setAuthenticator(model.getAuthenticator());
|
entity.setAuthenticator(model.getAuthenticator());
|
||||||
entity.setPriority(model.getPriority());
|
entity.setPriority(model.getPriority());
|
||||||
entity.setRequirement(model.getRequirement());
|
entity.setRequirement(model.getRequirement());
|
||||||
entity.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
entity.setAuthenticatorFlow(model.isAuthenticatorFlow());
|
entity.setAuthenticatorFlow(model.isAuthenticatorFlow());
|
||||||
entity.setFlowId(model.getFlowId());
|
entity.setFlowId(model.getFlowId());
|
||||||
entity.setParentFlow(model.getParentFlow());
|
entity.setParentFlow(model.getParentFlow());
|
||||||
|
@ -1449,7 +1447,6 @@ public class RealmAdapter extends AbstractMongoAdapter<MongoRealmEntity> impleme
|
||||||
entity.setPriority(model.getPriority());
|
entity.setPriority(model.getPriority());
|
||||||
entity.setRequirement(model.getRequirement());
|
entity.setRequirement(model.getRequirement());
|
||||||
entity.setFlowId(model.getFlowId());
|
entity.setFlowId(model.getFlowId());
|
||||||
entity.setUserSetupAllowed(model.isUserSetupAllowed());
|
|
||||||
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
entity.setAuthenticatorConfig(model.getAuthenticatorConfig());
|
||||||
updateMongoEntity();
|
updateMongoEntity();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,14 @@ public interface ConfigurableAuthenticatorFactory extends ConfiguredProvider {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
AuthenticationExecutionModel.Requirement[] getRequirementChoices();
|
AuthenticationExecutionModel.Requirement[] getRequirementChoices();
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Does this authenticator have required actions that can set if the user does not have
|
||||||
|
* this authenticator set up?
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean isUserSetupAllowed();
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class DefaultAuthenticationFlow implements AuthenticationFlow {
|
||||||
configuredFor = authenticator.configuredFor(processor.getSession(), processor.getRealm(), authUser);
|
configuredFor = authenticator.configuredFor(processor.getSession(), processor.getRealm(), authUser);
|
||||||
if (!configuredFor) {
|
if (!configuredFor) {
|
||||||
if (model.isRequired()) {
|
if (model.isRequired()) {
|
||||||
if (model.isUserSetupAllowed()) {
|
if (factory.isUserSetupAllowed()) {
|
||||||
AuthenticationProcessor.logger.debugv("authenticator SETUP_REQUIRED: {0}", factory.getId());
|
AuthenticationProcessor.logger.debugv("authenticator SETUP_REQUIRED: {0}", factory.getId());
|
||||||
processor.getClientSession().setExecutionStatus(model.getId(), ClientSessionModel.ExecutionStatus.SETUP_REQUIRED);
|
processor.getClientSession().setExecutionStatus(model.getId(), ClientSessionModel.ExecutionStatus.SETUP_REQUIRED);
|
||||||
authenticator.setRequiredActions(processor.getSession(), processor.getRealm(), processor.getClientSession().getAuthenticatedUser());
|
authenticator.setRequiredActions(processor.getSession(), processor.getRealm(), processor.getClientSession().getAuthenticatedUser());
|
||||||
|
|
|
@ -152,7 +152,8 @@ public class FormAuthenticationFlow implements AuthenticationFlow {
|
||||||
executionStatus.put(formActionExecution.getId(), ClientSessionModel.ExecutionStatus.SKIPPED);
|
executionStatus.put(formActionExecution.getId(), ClientSessionModel.ExecutionStatus.SKIPPED);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
FormAction action = processor.getSession().getProvider(FormAction.class, formActionExecution.getAuthenticator());
|
FormActionFactory factory = (FormActionFactory)processor.getSession().getKeycloakSessionFactory().getProviderFactory(FormAction.class, formActionExecution.getAuthenticator());
|
||||||
|
FormAction action = factory.create(processor.getSession());
|
||||||
|
|
||||||
UserModel authUser = processor.getClientSession().getAuthenticatedUser();
|
UserModel authUser = processor.getClientSession().getAuthenticatedUser();
|
||||||
if (action.requiresUser() && authUser == null) {
|
if (action.requiresUser() && authUser == null) {
|
||||||
|
@ -163,7 +164,7 @@ public class FormAuthenticationFlow implements AuthenticationFlow {
|
||||||
configuredFor = action.configuredFor(processor.getSession(), processor.getRealm(), authUser);
|
configuredFor = action.configuredFor(processor.getSession(), processor.getRealm(), authUser);
|
||||||
if (!configuredFor) {
|
if (!configuredFor) {
|
||||||
if (formActionExecution.isRequired()) {
|
if (formActionExecution.isRequired()) {
|
||||||
if (formActionExecution.isUserSetupAllowed()) {
|
if (factory.isUserSetupAllowed()) {
|
||||||
AuthenticationProcessor.logger.debugv("authenticator SETUP_REQUIRED: {0}", formExecution.getAuthenticator());
|
AuthenticationProcessor.logger.debugv("authenticator SETUP_REQUIRED: {0}", formExecution.getAuthenticator());
|
||||||
executionStatus.put(formActionExecution.getId(), ClientSessionModel.ExecutionStatus.SETUP_REQUIRED);
|
executionStatus.put(formActionExecution.getId(), ClientSessionModel.ExecutionStatus.SETUP_REQUIRED);
|
||||||
requiredActions.add(action);
|
requiredActions.add(action);
|
||||||
|
|
|
@ -78,4 +78,10 @@ public class CookieAuthenticatorFactory implements AuthenticatorFactory {
|
||||||
public List<ProviderConfigProperty> getConfigProperties() {
|
public List<ProviderConfigProperty> getConfigProperties() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,11 @@ public class OTPFormAuthenticatorFactory implements AuthenticatorFactory {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = {
|
public static final AuthenticationExecutionModel.Requirement[] REQUIREMENT_CHOICES = {
|
||||||
AuthenticationExecutionModel.Requirement.REQUIRED,
|
AuthenticationExecutionModel.Requirement.REQUIRED,
|
||||||
AuthenticationExecutionModel.Requirement.OPTIONAL,
|
AuthenticationExecutionModel.Requirement.OPTIONAL,
|
||||||
|
|
|
@ -84,4 +84,10 @@ public class SpnegoAuthenticatorFactory implements AuthenticatorFactory {
|
||||||
public List<ProviderConfigProperty> getConfigProperties() {
|
public List<ProviderConfigProperty> getConfigProperties() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,4 +81,10 @@ public class UsernamePasswordFormFactory implements AuthenticatorFactory {
|
||||||
public List<ProviderConfigProperty> getConfigProperties() {
|
public List<ProviderConfigProperty> getConfigProperties() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,6 +82,12 @@ public class ValidateOTP extends AbstractDirectGrantAuthenticator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayType() {
|
public String getDisplayType() {
|
||||||
return "OTP";
|
return "OTP";
|
||||||
|
|
|
@ -73,6 +73,12 @@ public class ValidatePassword extends AbstractDirectGrantAuthenticator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayType() {
|
public String getDisplayType() {
|
||||||
return "Password";
|
return "Password";
|
||||||
|
|
|
@ -103,6 +103,12 @@ public class ValidateUsername extends AbstractDirectGrantAuthenticator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplayType() {
|
public String getDisplayType() {
|
||||||
return "Username Validation";
|
return "Username Validation";
|
||||||
|
|
|
@ -82,6 +82,11 @@ public class RegistrationPage implements FormAuthenticator, FormAuthenticatorFac
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postInit(KeycloakSessionFactory factory) {
|
public void postInit(KeycloakSessionFactory factory) {
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,11 @@ public class RegistrationPassword implements FormAction, FormActionFactory {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
|
|
|
@ -110,6 +110,12 @@ public class RegistrationProfile implements FormAction, FormActionFactory {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
|
|
|
@ -158,6 +158,12 @@ public class RegistrationRecaptcha implements FormAction, FormActionFactory, Con
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
|
|
|
@ -149,6 +149,12 @@ public class RegistrationUserCreation implements FormAction, FormActionFactory {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUserSetupAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue