8000 Do not add steps if feature disabled in default flows by rmartinc · Pull Request #40964 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Do not add steps if feature disabled in default flows #40964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -387,22 +387,26 @@ public static void browserFlow(RealmModel realm, boolean migrate) {
realm.addAuthenticatorExecution(execution);

// webauthn as disabled
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("webauthn-authenticator");
execution.setPriority(30);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
if (Profile.isFeatureEnabled(Profile.Feature.WEB_AUTHN)) {
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("webauthn-authenticator");
execution.setPriority(30);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
}

// recovery-codes as disabled
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("auth-recovery-authn-code-form");
execution.setPriority(40);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
if (Profile.isFeatureEnabled(Profile.Feature.RECOVERY_CODES)) {
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("auth-recovery-authn-code-form");
execution.setPriority(40);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
}

addOrganizationBrowserFlowStep(realm, browser);
}
Expand Down Expand Up @@ -669,22 +673,26 @@ public static void firstBrokerLoginFlow(RealmModel realm, boolean migrate) {
realm.addAuthenticatorExecution(execution);

// webauthn as disabled
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("webauthn-authenticator");
execution.setPriority(30);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
if (Profile.isFeatureEnabled(Profile.Feature.WEB_AUTHN)) {
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("webauthn-authenticator");
execution.setPriority(30);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
}

// recovery-codes as disabled
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("auth-recovery-authn-code-form");
execution.setPriority(40);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
if (Profile.isFeatureEnabled(Profile.Feature.RECOVERY_CODES)) {
execution = new AuthenticationExecutionModel();
execution.setParentFlow(conditionalOTP.getId());
execution.setRequirement(AuthenticationExecutionModel.Requirement.DISABLED);
execution.setAuthenticator("auth-recovery-authn-code-form");
execution.setPriority(40);
execution.setAuthenticatorFlow(false);
realm.addAuthenticatorExecution(execution);
}

addOrganizationFirstBrokerFlowStep(realm, firstBrokerLogin);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,8 @@ boolean isConditionalSubflowDisabled(AuthenticationExecutionModel model) {
}

private boolean isConditionalAuthenticator(AuthenticationExecutionModel model) {
return !model.isAuthenticatorFlow() && model.getAuthenticator() != null && createAuthenticator(getAuthenticatorFactory(model)) instanceof ConditionalAuthenticator;
return !model.isAuthenticatorFlow() && model.getAuthenticator() != null && model.isEnabled()
&& createAuthenticator(getAuthenticatorFactory(model)) instanceof ConditionalAuthenticator;
}

private AuthenticatorFactory getAuthenticatorFactory(AuthenticationExecutionModel model) {
Expand Down
684D
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,19 @@ public void loginSuccessfulWithDynamicScope() {
events.expectLogin().user(userId).assertEvent();
}

@Test
public void loginSuccessfulWithoutWebAuthn() {
testingClient.disableFeature(Profile.Feature.WEB_AUTHN);
try {
loginPage.open();
loginPage.login("test-user@localhost", getPassword("test-user@localhost"));
Assert.assertEquals(RequestType.AUTH_RESPONSE, appPage.getRequestType());
events.expectLogin().assertEvent();
} finally {
testingClient.enableFeature(Profile.Feature.WEB_AUTHN);
}
}

@Test
public void testExecuteActionIfSessionExists() {
loginPage.open();
Expand Down
Loading
0