(Legacy) Customizing the HTML Form Adapter for passwordless authentication with a security key
Customize the passwordless authentication flow by adding a security key icon to the passwordless flow button. You can also choose to show the security key button when using webAuthn-compatible browsers only.
Before you begin
About this task
PingFederate 10.2 and later automatically includes a passwordless security key icon with the HTML Form Adapter, and automatically hides the security key button when the browser is not compatible with WebAuthn. For PingFederate 10.1 and lower, manually customize the HTML Form Adapter to:
-
Add an icon to the passwordless flow button in the HTML Form Adapter. Add the security key icon provided by Ping Identity, or add your own custom icon.
-
Choose to show the security key button only when the browser is webAuthn compatible.
Steps
-
To add a passwordless authentication flow icon:
-
Download the security key image here, and in the relevant PingFederate folder, save the icon to the
server/default/conf/template/assets/imagesfolder asicon-securitykey.png. -
In the PingFederate folder, go to
server/default/conf/template/assets/cssand open themain.cssfile in a text editor. -
Add the following code to the
main.cssfile, and then save the file.body .button-container .social-media.securitykey { background-image: url("../images/icon-securitykey.png"); background-size: auto 10px; background-position: left 10px center }
-
-
To hide the security key button when a browser does not support WebAuthn:
-
In the relevant PingFederate folder, go to
server/default/conf/templateand openhtml.form.login.template.htmlfile in a text editor. -
In the html body add
isSecurityKeyAvailable();to theonloadattribute.<body onload="setFocus();isSecurityKeyAvailable();isWebAuthnPlatformAuthenticatorAvailable();">
-
In the
scriptelement, add a new function, and then save the file.function isSecurityKeyAvailable() { var webauthnSupported = IsWebAuthnSupported(); if (!webauthnSupported) { theElement = document.getElementById("securitykey-div"); if (theElement) { theElement.style.display = "none"; } } }
-