Add webauthn for organization authenticator when org is selected

Closes #44735

Signed-off-by: rmartinc <rmartinc@redhat.com>
This commit is contained in:
rmartinc 2025-12-09 12:27:25 +01:00 committed by Marek Posolda
parent 7ecc4c5774
commit 7be37f1e0d
2 changed files with 21 additions and 0 deletions

View File

@ -357,6 +357,10 @@ public class OrganizationAuthenticator extends IdentityProviderAuthenticator {
form.addError(new FormMessage("Your email domain matches the " + organization.getName() + " organization but you don't have an account yet."));
}
// user is null, setup webauthn data if enabled
if (webauthnAuth.isPasskeysEnabled()) {
webauthnAuth.fillContextForm(context);
}
context.challenge(form.createLoginUsername());
}

View File

@ -109,6 +109,23 @@ public class PasskeysOrganizationAuthenticationTest extends AbstractWebAuthnVirt
appPage.assertCurrent();
events.expectLogin()
.user(user.getId())
.detail(Details.USERNAME, user.getUsername())
.detail(Details.CREDENTIAL_TYPE, WebAuthnCredentialModel.TYPE_PASSWORDLESS)
.detail(WebAuthnConstants.USER_VERIFICATION_CHECKED, "true")
.assertEvent();
logout();
events.clear();
// login forcing the organization
oauth.scope("organization:email");
oauth.openLoginForm();
WaitUtils.waitForPageToLoad();
appPage.assertCurrent();
events.expectLogin()
.user(user.getId())
.detail(Details.USERNAME, user.getUsername())