WebAuthn Demo

This page demonstrates the WebAuthn JSF integration component. More information about WebAuthn can be found at the official W3C Web Authentication specification page.

Manage WebAuthn keys within Chrome via chrome://settings/passkeys.

Manage security keys within Chrome via: chrome://settings/securityKeys.

Registration
Authentication
UsersActions
No records found.
<div id="example">
            <h:form id="webAuthnForm">
                <ejsf:webAuthn credentialRepository="#{webAuthnCredentialRepository}" id="webAuthn" relyingPartyId="#{webAuthnController.relyingPartyId}" relyingPartyName="Enterprise JSF Demo" username="#{webAuthnController.username}">
                    <ejsf:webAuthnRegistration allowUntrustedAttestation="#{webAuthnController.allowUntrustedAttestation}" attestationConveyance="#{webAuthnController.attestationConveyance}" attestationTrustSource="#{webAuthnAttestationTrustSource}" authenticatorAttachment="#{webAuthnController.authenticatorAttachment}" errorListener="#{webAuthnController.registrationErrorListener}" listener="#{webAuthnController.registeredListener}" messageInterceptor="#{webAuthnController.registrationMessageInterceptor}" residentKey="#{webAuthnController.residentKey}" update=":messages" userId="#{webAuthnController.userId}" userVerification="#{webAuthnController.userVerification}"/>
                    <ejsf:webAuthnAuthentication errorListener="#{webAuthnController.authenticationErrorListener}" listener="#{webAuthnController.authenticatedListener}" messageInterceptor="#{webAuthnController.authenticationMessageInterceptor}" prfListener="#{webAuthnController.prfListener}" update=":messages" userVerification="#{webAuthnController.userVerification}"/>
                    <p:ajax event="error" listener="#{webAuthnController.errorListener}" update=":messages"/>
                </ejsf:webAuthn>
            </h:form>
            <h:form>
                <h:panelGrid columns="2">
                    <p:outputLabel for="@next" value="User Verification:"/>
                    <p:selectOneMenu value="#{webAuthnController.userVerification}">
                        <f:selectItem itemLabel="-none-" noSelectionOption="true"/>
                        <f:selectItem itemLabel="required" itemValue="required"/>
                        <f:selectItem itemLabel="preferred" itemValue="preferred"/>
                        <f:selectItem itemLabel="discouraged" itemValue="discouraged"/>
                        <p:ajax event="change"/>
                    </p:selectOneMenu>
                </h:panelGrid>
            </h:form>
            <p:spacer height="10px"/>
            <p:fieldset legend="Registration">
                <h:form>
                    <h:panelGrid columns="2">
                        <p:outputLabel for="@next" value="Authenticator attachment:"/>
                        <p:selectOneMenu value="#{webAuthnController.authenticatorAttachment}">
                            <f:selectItem itemLabel="-none-" noSelectionOption="true"/>
                            <f:selectItem itemLabel="platform" itemValue="platform"/>
                            <f:selectItem itemLabel="cross-platform" itemValue="cross-platform"/>
                            <p:ajax event="change"/>
                        </p:selectOneMenu>

                        <p:outputLabel for="@next" value="Resident key:"/>
                        <p:selectOneMenu value="#{webAuthnController.residentKey}">
                            <f:selectItem itemLabel="-none-" noSelectionOption="true"/>
                            <f:selectItem itemLabel="required" itemValue="required"/>
                            <f:selectItem itemLabel="preferred" itemValue="preferred"/>
                            <f:selectItem itemLabel="discouraged" itemValue="discouraged"/>
                            <p:ajax event="change"/>
                        </p:selectOneMenu>

                        <p:outputLabel for="@next" value="Attestation Conveyance:"/>
                        <p:selectOneMenu value="#{webAuthnController.attestationConveyance}">
                            <f:selectItem itemLabel="-none-" noSelectionOption="true"/>
                            <f:selectItem itemLabel="none" itemValue="none"/>
                            <f:selectItem itemLabel="indirect" itemValue="indirect"/>
                            <f:selectItem itemLabel="direct" itemValue="direct"/>
                            <f:selectItem itemLabel="enterprise" itemValue="enterprise"/>
                            <p:ajax event="change"/>
                        </p:selectOneMenu>

                        <p:outputLabel for="@next" value="Allow Untrusted Attestation:"/>
                        <p:toggleSwitch value="#{webAuthnController.allowUntrustedAttestation}">
                            <p:ajax/>
                        </p:toggleSwitch>
                    </h:panelGrid>
                </h:form>
                <h:form id="registrationForm">
                    <h:panelGrid columns="3">
                        <p:outputLabel for="@next" value="Username:"/>
                        <p:inputText autocomplete="username webauthn" id="username" required="true" value="#{webAuthnController.username}">
                            <ejsf:webAuthnUsernameValidator credentialRepository="#{webAuthnCredentialRepository}" mode="registration"/>
                        </p:inputText>
                        <p:message for="@previous"/>
                    </h:panelGrid>
                    <p:commandButton id="registerButton" update="@form" value="Register">
                        <ejsf:webAuthnRegister/>
                    </p:commandButton>
                </h:form>
            </p:fieldset>
            <p:spacer height="10px"/>
            <p:fieldset legend="Authentication">
                <h:form id="authenticationForm">
                    <h:panelGrid columns="3">
                        <p:outputLabel for="@next" value="Username:"/>
                        <p:inputText autocomplete="username webauthn" id="username" required="true" value="#{webAuthnController.username}">
                            <ejsf:webAuthnUsernameValidator credentialRepository="#{webAuthnCredentialRepository}" mode="authentication"/>
                        </p:inputText>
                        <p:message for="@previous"/>
                    </h:panelGrid>
                    <p:commandButton id="authenticateButton" update="@form" value="Authenticate">
                        <ejsf:webAuthnAuthenticate/>
                    </p:commandButton>
                </h:form>
            </p:fieldset>
        </div>