Skip to content

Commit

Permalink
KEYCLOAK-14679 Unable to log in with WebAuthn on unsupported browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
mabartos authored and mposolda committed Oct 29, 2020
1 parent ceb46c2 commit 2e59d5c
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 360,7 @@ private void setErrorResponse(RequiredActionContext context, final String errorC
.detail(ERR_DETAIL_LABEL, errorMessage)
.error(Errors.INVALID_USER_CREDENTIALS);
errorResponse = context.form()
.setError(errorCase)
.setError(errorCase, errorMessage)
.setAttribute(WEB_AUTHN_TITLE_ATTR, WEBAUTHN_REGISTER_TITLE)
.createWebAuthnErrorPage();
context.challenge(errorResponse);
Expand All @@ -372,7 372,7 @@ private void setErrorResponse(RequiredActionContext context, final String errorC
.detail(ERR_DETAIL_LABEL, errorMessage)
.error(Errors.INVALID_REGISTRATION);
errorResponse = context.form()
.setError(errorCase)
.setError(errorCase, errorMessage)
.setAttribute(WEB_AUTHN_TITLE_ATTR, WEBAUTHN_REGISTER_TITLE)
.createWebAuthnErrorPage();
context.challenge(errorResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 364,15 @@ webauthn-passwordless-help-text=Use your security key for passwordless sign in.
webauthn-login-title=Security Key login
webauthn-registration-title=Security Key Registration
webauthn-available-authenticators=Available authenticators
webauthn-unsupported-browser-text=WebAuthn is not supported by this browser. Try another one or contact your administrator.

# WebAuthn Error
webauthn-error-title=Security Key Error
webauthn-error-registration=Failed to register your Security key.
webauthn-error-api-get=Failed to authenticate by the Security key.
webauthn-error-registration=Failed to register your Security key.<br/> {0}
webauthn-error-api-get=Failed to authenticate by the Security key.<br/> {0}
webauthn-error-different-user=First authenticated user is not the one authenticated by the Security key.
webauthn-error-auth-verification=Security key authentication result is invalid.
webauthn-error-register-verification=Security key registration result is invalid.
webauthn-error-auth-verification=Security key authentication result is invalid.<br/> {0}
webauthn-error-register-verification=Security key registration result is invalid.<br/> {0}
webauthn-error-user-not-found=Unknown user authenticated by the Security key.

# Identity provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 62,14 @@
function doAuthenticate(allowCredentials) {
// Check if WebAuthn is supported by this browser
if (!window.PublicKeyCredential) {
$("#error").val("${msg("webauthn-unsupported-browser-text")?no_esc}");
$("#webauth").submit();
return;
}
let challenge = "${challenge}";
let userVerification = "${userVerification}";
let rpId = "${rpId}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 22,14 @@
<script type="text/javascript">
function registerSecurityKey() {
// Check if WebAuthn is supported by this browser
if (!window.PublicKeyCredential) {
$("#error").val("${msg("webauthn-unsupported-browser-text")?no_esc}");
$("#register").submit();
return;
}
// mandatory parameters
let challenge = "${challenge}";
let userid = "${userid}";
Expand Down

0 comments on commit 2e59d5c

Please sign in to comment.