p2-inc / phasetwo-admin-portal

https://phasetwo.io
Other
18 stars 14 forks source link

Signin Page Security Key #58

Closed pnzrr closed 1 year ago

pnzrr commented 1 year ago

On the Signing In page, if there is no type: "webauthn" in the response from /credentials, don’t show a section for Security key

image

Same for “otp” and “webauthn-passwordless”

pnzrr commented 1 year ago

Right now the method will only includes items present in the userCredentialMetadatas array. If that's empty there is no table body.

{
        "type": "webauthn",
        "category": "two-factor",
        "displayName": "webauthn-display-name",
        "helptext": "webauthn-help-text",
        "iconCssClass": "kcAuthenticatorWebAuthnClass",
        "createAction": "webauthn-register",
        "removeable": true,
        "userCredentialMetadatas": [
            {
                "credential": {
                    "id": "a92d933c-80d3-415f-8099-8733c41450ff",
                    "type": "webauthn",
                    "userLabel": "WebAuthn Authenticator (Default Label)",
                    "createdDate": 1680577055435,
                    "credentialData": "{\"aaguid\":\"00000000-0000-0000-0000-000000000000\",\"credentialId\":\"CdyU+c6k2FDPdjjZvr/2zW/D0JkPqhCTgu8KalP4o8d21EqIFU9Dv+4E3tCZxJDDeNRv4L0W1+phm8YOfqn3uA==\",\"counter\":1,\"credentialPublicKey\":\"pQECAyYgASFYIOoDEllF45pmgQ5t1UvhK-DjbUv2oVHfdPktfkoApXvWIlggHNYT2mEslJZtDFaYg0m7lOenvSh5KEo-xaBmO5OJIQQ\",\"attestationStatementFormat\":\"none\",\"transports\":[\"usb\"]}"
                }
            }
        ]
    },
image image
xgp commented 1 year ago

@pnzrr the credentials endpoint returns an array of that object. If there is none with type: webauth, we should hide that section altogether. Basically what it's doing is showing you all allowable types in the top level array, and then populating the userCredentialMetadatas in each object if the user has that type.

pnzrr commented 1 year ago

Ah got you, hide the whole section, not just the table.