Search in sources :

Example 1 with WebAuthnCredentials

use of io.vertx.ext.auth.webauthn.WebAuthnCredentials in project gravitee-access-management by gravitee-io.

the class WebAuthnResponseEndpoint method handle.

@Override
public void handle(RoutingContext ctx) {
    try {
        // might throw runtime exception if there's no json or is bad formed
        final JsonObject webauthnResp = ctx.getBodyAsJson();
        // input validation
        if (isEmptyString(webauthnResp, "id") || isEmptyString(webauthnResp, "rawId") || isEmptyObject(webauthnResp, "response") || isEmptyString(webauthnResp, "type") || !"public-key".equals(webauthnResp.getString("type"))) {
            logger.debug("Response missing one or more of id/rawId/response/type fields, or type is not public-key");
            ctx.fail(400);
            return;
        }
        // session validation
        final Session session = ctx.session();
        if (ctx.session() == null) {
            logger.error("No session or session handler is missing.");
            ctx.fail(500);
            return;
        }
        final Client client = ctx.get(ConstantKeys.CLIENT_CONTEXT_KEY);
        final String userId = session.get(ConstantKeys.PASSWORDLESS_CHALLENGE_USER_ID);
        final String username = session.get(ConstantKeys.PASSWORDLESS_CHALLENGE_USERNAME_KEY);
        final String credentialId = webauthnResp.getString("id");
        // authenticate the user
        webAuthn.authenticate(// authInfo
        new WebAuthnCredentials().setOrigin(origin).setChallenge(session.get(ConstantKeys.PASSWORDLESS_CHALLENGE_KEY)).setUsername(session.get(ConstantKeys.PASSWORDLESS_CHALLENGE_USERNAME_KEY)).setWebauthn(webauthnResp), authenticate -> {
            // invalidate the challenge
            session.remove(ConstantKeys.PASSWORDLESS_CHALLENGE_KEY);
            session.remove(ConstantKeys.PASSWORDLESS_CHALLENGE_USERNAME_KEY);
            session.remove(ConstantKeys.PASSWORDLESS_CHALLENGE_USER_ID);
            if (authenticate.succeeded()) {
                // create the authentication context
                final AuthenticationContext authenticationContext = createAuthenticationContext(ctx);
                // authenticate the user
                authenticateUser(authenticationContext, client, username, h -> {
                    if (h.failed()) {
                        logger.error("An error has occurred while authenticating user {}", username, h.cause());
                        ctx.fail(401);
                        return;
                    }
                    final User user = h.result();
                    final io.gravitee.am.model.User authenticatedUser = ((io.gravitee.am.gateway.handler.common.vertx.web.auth.user.User) user).getUser();
                    // check if the authenticated user is the same as the one in session
                    if (userId == null || !userId.equals(authenticatedUser.getId())) {
                        logger.error("Invalid authenticated user {}, user in session was {}", authenticatedUser.getId(), userId);
                        ctx.fail(401);
                        return;
                    }
                    // update the credential
                    updateCredential(authenticationContext, credentialId, userId, credentialHandler -> {
                        if (credentialHandler.failed()) {
                            logger.error("An error has occurred while authenticating user {}", username, credentialHandler.cause());
                            ctx.fail(401);
                            return;
                        }
                        // save the user into the context
                        ctx.getDelegate().setUser(user);
                        ctx.session().put(ConstantKeys.PASSWORDLESS_AUTH_COMPLETED_KEY, true);
                        ctx.session().put(ConstantKeys.WEBAUTHN_CREDENTIAL_ID_CONTEXT_KEY, credentialId);
                        // Now redirect back to authorization endpoint.
                        final MultiMap queryParams = RequestUtils.getCleanedQueryParams(ctx.request());
                        final String returnURL = UriBuilderRequest.resolveProxyRequest(ctx.request(), ctx.get(CONTEXT_PATH) + "/oauth/authorize", queryParams, true);
                        ctx.response().putHeader(HttpHeaders.LOCATION, returnURL).end();
                    });
                });
            } else {
                logger.error("Unexpected exception", authenticate.cause());
                ctx.fail(authenticate.cause());
            }
        });
    } catch (IllegalArgumentException e) {
        logger.error("Unexpected exception", e);
        ctx.fail(400);
    } catch (RuntimeException e) {
        logger.error("Unexpected exception", e);
        ctx.fail(e);
    }
}
Also used : SimpleAuthenticationContext(io.gravitee.am.identityprovider.api.SimpleAuthenticationContext) AuthenticationContext(io.gravitee.am.identityprovider.api.AuthenticationContext) User(io.vertx.ext.auth.User) JsonObject(io.vertx.core.json.JsonObject) MultiMap(io.vertx.reactivex.core.MultiMap) WebAuthnCredentials(io.vertx.ext.auth.webauthn.WebAuthnCredentials) Client(io.gravitee.am.model.oidc.Client) Session(io.vertx.reactivex.ext.web.Session)

Example 2 with WebAuthnCredentials

use of io.vertx.ext.auth.webauthn.WebAuthnCredentials in project gravitee-access-management by gravitee-io.

the class AttestationTest method testTPMAttestation.

@Test
public void testTPMAttestation() {
    WebAuthn webAuthN = WebAuthn.create(Vertx.vertx(), new GraviteeWebAuthnOptions().setRelyingParty(new RelyingParty().setName("FIDO Examples Corporation")));
    JsonObject packedFullAttestationWebAuthnSample = new JsonObject().put("rawId", "hWzdFiPbOMQ5KNBsMhs-Zeh8F0iTHrH63YKkrxJFgjQ").put("id", "hWzdFiPbOMQ5KNBsMhs-Zeh8F0iTHrH63YKkrxJFgjQ").put("response", new JsonObject().put("clientDataJSON", "ew0KCSJ0eXBlIiA6ICJ3ZWJhdXRobi5jcmVhdGUiLA0KCSJjaGFsbGVuZ2UiIDogIndrNkxxRVhBTUFacHFjVFlsWTJ5b3I1RGppeUlfYjFneTluRE90Q0IxeUdZbm1fNFdHNFVrMjRGQXI3QXhUT0ZmUU1laWdrUnhPVExaTnJMeEN2Vl9RIiwNCgkib3JpZ2luIiA6ICJodHRwczovL3dlYmF1dGhuLm9yZyIsDQoJInRva2VuQmluZGluZyIgOiANCgl7DQoJCSJzdGF0dXMiIDogInN1cHBvcnRlZCINCgl9DQp9").put("attestationObject", "o2NmbXRjdHBtaGF1dGhEYXRhWQFnlWkIjx7O4yMpVANdvRDXyuORMFonUbVZu4_Xy7IpvdRFAAAAAAiYcFjK3EuBtuEw3lDcvpYAIIVs3RYj2zjEOSjQbDIbPmXofBdIkx6x-t2CpK8SRYI0pAEDAzkBACBZAQDF2m9Nk1e94gL1xVjNCjFW0lTy4K2atXkx-YJrdH3hrE8p1gcIdNzleRDhmERJnY5CRwM5sXDQIrUBq4jpwvTtMC5HGccN6-iEJAPtm9_CJzCmGhtw9hbF8bcAys94RhN9xLLUaajhWqtPrYZXCEAi0o9E2QdTIxJrcAfJgZOf33JMr0--R1BAQxpOoGRDC8ss-tfQW9ufZLWw4JUuz4Z5Jz1sbfqBYB8UUDMWoT0HgsMaPmvd7T17xGvB-pvvDf-Dt96vFGtYLEZEgho8Yu26pr5CK_BOQ-2vX9N4MIYVPXNhogMGGmKYqybhM3yhye0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hUEMK2q4wxuwIFOnHIDF0Qljhf47RncHViQXJlYVkBNgABAAsABgRyACCd_8vzbDg65pn7mGjcbcuJ1xU4hL4oA5IsEkFYv60irgAQABAIAAAAAAABAMXab02TV73iAvXFWM0KMVbSVPLgrZq1eTH5gmt0feGsTynWBwh03OV5EOGYREmdjkJHAzmxcNAitQGriOnC9O0wLkcZxw3r6IQkA-2b38InMKYaG3D2FsXxtwDKz3hGE33EstRpqOFaq0-thlcIQCLSj0TZB1MjEmtwB8mBk5_fckyvT75HUEBDGk6gZEMLyyz619Bb259ktbDglS7PhnknPWxt-oFgHxRQMxahPQeCwxo-a93tPXvEa8H6m-8N_4O33q8Ua1gsRkSCGjxi7bqmvkIr8E5D7a9f03gwhhU9c2GiAwYaYpirJuEzfKHJ7QZ0GlkFR3mI5yAwTq4YnX8"));
    webAuthN.authenticate(new WebAuthnCredentials(new JsonObject().put("username", "gravitee").put("origin", "https://webauthn.org").put("webauthn", packedFullAttestationWebAuthnSample).put("challenge", "wk6LqEXAMAZpqcTYlY2yor5DjiyI_b1gy9nDOtCB1yGYnm_4WG4Uk24FAr7AxTOFfQMeigkRxOTLZNrLxCvV_Q")), u -> {
        // process should not failed for an encoding issue
        Assert.assertTrue(u.failed());
        Assert.assertFalse(u.cause().getMessage().contains("Illegal base64 character"));
    });
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.ext.auth.webauthn.WebAuthn) WebAuthnCredentials(io.vertx.ext.auth.webauthn.WebAuthnCredentials) GraviteeWebAuthnOptions(io.gravitee.am.gateway.handler.vertx.auth.webauthn.GraviteeWebAuthnOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 3 with WebAuthnCredentials

use of io.vertx.ext.auth.webauthn.WebAuthnCredentials in project gravitee-access-management by gravitee-io.

the class AttestationTest method testAppleAttestation.

@Test
public void testAppleAttestation() {
    WebAuthn webAuthN = WebAuthn.create(Vertx.vertx(), new GraviteeWebAuthnOptions().setRelyingParty(new RelyingParty().setName("FIDO Examples Corporation")));
    JsonObject packedFullAttestationWebAuthnSample = new JsonObject().put("rawId", "J4lAqPXhefDrUD7oh5LQMbBH5TE").put("id", "J4lAqPXhefDrUD7oh5LQMbBH5TE").put("type", "public-key").put("response", new JsonObject().put("clientDataJSON", "eyJ0eXBlIjoid2ViYXV0aG4uY3JlYXRlIiwiY2hhbGxlbmdlIjoiaDV4U3lJUk14MklRUHIxbVFrNkdEOThYU1FPQkhnTUhWcEpJa01WOU5rYyIsIm9yaWdpbiI6Imh0dHBzOi8vZGV2LmRvbnRuZWVkYS5wdyJ9").put("attestationObject", "o2NmbXRlYXBwbGVnYXR0U3RtdKJjYWxnJmN4NWOCWQJHMIICQzCCAcmgAwIBAgIGAXSFZw11MAoGCCqGSM49BAMCMEgxHDAaBgNVBAMME0FwcGxlIFdlYkF1dGhuIENBIDExEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwHhcNMjAwOTEzMDI0OTE3WhcNMjAwOTE0MDI1OTE3WjCBkTFJMEcGA1UEAwxAMzI3ZWI1ODhmMTU3ZDZiYjY0NTRmOTdmNWU1NmM4NmY0NGI1MDdjODgxOGZmMjMwYmQwZjYyNWJkYjY1YmNiNjEaMBgGA1UECwwRQUFBIENlcnRpZmljYXRpb24xEzARBgNVBAoMCkFwcGxlIEluYy4xEzARBgNVBAgMCkNhbGlmb3JuaWEwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARiAlQ11YPbcpjmwM93iOefyu00h8-4BALNKnBDB5I9n17wD5wNqP0hYua340eB75Z1L_V6I7R4qraq7763zj9mo1UwUzAMBgNVHRMBAf8EAjAAMA4GA1UdDwEB_wQEAwIE8DAzBgkqhkiG92NkCAIEJjAkoSIEIPuwR1EQvcCtYCRahnJWisqz6YYLEAXH16p0WXbLfY6tMAoGCCqGSM49BAMCA2gAMGUCMDpEvt_ifVr8uu1rnLykezfrHBXwLL-D6DO73l_sX_DLRw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thnCredentials(new JsonObject().put("username", "gravitee").put("webauthn", packedFullAttestationWebAuthnSample).put("challenge", "h5xSyIRMx2IQPr1mQk6GD98XSQOBHgMHVpJIkMV9Nkc")), u -> {
        // process should not failed for an encoding issue
        Assert.assertTrue(u.failed());
        Assert.assertFalse(u.cause().getMessage().contains("Illegal base64 character"));
    });
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.ext.auth.webauthn.WebAuthn) WebAuthnCredentials(io.vertx.ext.auth.webauthn.WebAuthnCredentials) GraviteeWebAuthnOptions(io.gravitee.am.gateway.handler.vertx.auth.webauthn.GraviteeWebAuthnOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 4 with WebAuthnCredentials

use of io.vertx.ext.auth.webauthn.WebAuthnCredentials in project gravitee-access-management by gravitee-io.

the class AttestationTest method testU2FAttestation.

@Test
public void testU2FAttestation() {
    WebAuthn webAuthN = WebAuthn.create(Vertx.vertx(), new GraviteeWebAuthnOptions().setRelyingParty(new RelyingParty().setName("FIDO Examples Corporation")));
    JsonObject packedFullAttestationWebAuthnSample = new JsonObject().put("rawId", "Bo-VjHOkJZy8DjnCJnIc0Oxt9QAz5upMdSJxNbd-GyAo6MNIvPBb9YsUlE0ZJaaWXtWH5FQyPS6bT_e698IirQ==").put("id", "Bo-VjHOkJZy8DjnCJnIc0Oxt9QAz5upMdSJxNbd-GyAo6MNIvPBb9YsUlE0ZJaaWXtWH5FQyPS6bT_e698IirQ==").put("type", "public-key").put("response", new JsonObject().put("clientDataJSON", "eyJjaGFsbGVuZ2UiOiJWdTh1RHFua3dPamQ4M0tMajZTY24yQmdGTkxGYkdSN0txX1hKSndRbm5hdHp0VVI3WElCTDdLOHVNUENJYVFtS3cxTUNWUTVhYXpOSkZrN05ha2dxQSIsImNsaWVudEV4dGVuc2lvbnMiOnt9LCJoYXNoQWxnb3JpdGhtIjoiU0hBLTI1NiIsIm9yaWdpbiI6Imh0dHBzOi8vbG9j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ABo-VjHOkJZy8DjnCJnIc0Oxt9QAz5upMdSJxNbd-GyAo6MNIvPBb9YsUlE0ZJaaWXtWH5FQyPS6bT_e698IiraUBAgMmIAEhWCA1c9AIeH5sN6x1Q-2qR7v255tkeGbWs0ECCDw35kJGBCJYIBjTUxruadjFFMnWlR5rPJr23sBJT9qexY9PCc9o8hmT"));
    webAuthN.authenticate(new WebAuthnCredentials(new JsonObject().put("username", "gravitee").put("origin", "https://localhost:8443").put("webauthn", packedFullAttestationWebAuthnSample).put("challenge", "Vu8uDqnkwOjd83KLj6Scn2BgFNLFbGR7Kq_XJJwQnnatztUR7XIBL7K8uMPCIaQmKw1MCVQ5aazNJFk7NakgqA")), u -> {
        // process should not failed for an encoding issue
        Assert.assertTrue(u.failed());
        Assert.assertFalse(u.cause().getMessage().contains("Illegal base64 character"));
    });
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.ext.auth.webauthn.WebAuthn) WebAuthnCredentials(io.vertx.ext.auth.webauthn.WebAuthnCredentials) GraviteeWebAuthnOptions(io.gravitee.am.gateway.handler.vertx.auth.webauthn.GraviteeWebAuthnOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 5 with WebAuthnCredentials

use of io.vertx.ext.auth.webauthn.WebAuthnCredentials in project gravitee-access-management by gravitee-io.

the class AttestationTest method testAndroidSafetyNetAttestation.

@Test
public void testAndroidSafetyNetAttestation() {
    WebAuthn webAuthN = WebAuthn.create(Vertx.vertx(), new GraviteeWebAuthnOptions().setRelyingParty(new RelyingParty().setName("FIDO Examples Corporation")));
    JsonObject packedFullAttestationWebAuthnSample = new JsonObject().put("rawId", "AZD7huwZVx7aW1efRa6Uq3JTQNorj3qA9yrLINXEcgvCQYtWiSQa1eOIVrXfCmip6MzP8KaITOvRLjy3TUHO7_c").put("id", "AZD7huwZVx7aW1efRa6Uq3JTQNorj3qA9yrLINXEcgvCQYtWiSQa1eOIVrXfCmip6MzP8KaITOvRLj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RVV2VmFCeFpWVzB2SXN4eWxiWllSNVMxSjIwSXRPLV9kSDFERWRkY1kzcmc3bzd6RlJGSGFnd0QyN3dCMzlCTmk4cVNVcG1heEk1VWhrNE04X3BDSWtmLXBwaUFoYXV0aERhdGFYxZVpCI8ezuMjKVQDXb0Q18rjkTBaJ1G1WbuP18uyKb3URQAAAAAAAAAAAAAAAAAAAAAAAAAAAEEBkPuG7BlXHtpbV59FrpSrclNA2iuPeoD3Kssg1cRyC8JBi1aJJBrV44hWtd8KaKnozM_wpohM69EuPLdNQc7v96UBAgMmIAEhWCBVEWSlJerLbRupcvBaXA5Cqpp1Ba46HZTH-dqgmeMCYSJYIIlzYLPXaVavxbpZ4G6ZJWJ6hwW_NgiKAHpSNL8Bwf_d"));
    webAuthN.authenticate(new WebAuthnCredentials(new JsonObject().put("username", "gravitee").put("webauthn", packedFullAttestationWebAuthnSample).put("challenge", "Tf65bS6D5temh2BwvptqgBPb25iZDRxjwC5ans91IIJDrcrOpnWTK4LVgFjeUV4GDMe44w8SI5NsZssIXTUvDg")), u -> {
        // process should not failed for an encoding issue
        Assert.assertTrue(u.failed());
        Assert.assertFalse(u.cause().getMessage().contains("Illegal base64 character"));
    });
}
Also used : RelyingParty(io.vertx.ext.auth.webauthn.RelyingParty) WebAuthn(io.vertx.ext.auth.webauthn.WebAuthn) WebAuthnCredentials(io.vertx.ext.auth.webauthn.WebAuthnCredentials) GraviteeWebAuthnOptions(io.gravitee.am.gateway.handler.vertx.auth.webauthn.GraviteeWebAuthnOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Aggregations

WebAuthnCredentials (io.vertx.ext.auth.webauthn.WebAuthnCredentials)13 JsonObject (io.vertx.core.json.JsonObject)11 GraviteeWebAuthnOptions (io.gravitee.am.gateway.handler.vertx.auth.webauthn.GraviteeWebAuthnOptions)8 RelyingParty (io.vertx.ext.auth.webauthn.RelyingParty)8 WebAuthn (io.vertx.ext.auth.webauthn.WebAuthn)8 Test (org.junit.Test)8 RestoreResult (io.quarkus.vertx.http.runtime.security.PersistentLoginManager.RestoreResult)3 User (io.vertx.ext.auth.User)2 Authenticator (io.vertx.ext.auth.webauthn.Authenticator)2 AttestationException (io.vertx.ext.auth.webauthn.impl.attestation.AttestationException)2 AuthenticationContext (io.gravitee.am.identityprovider.api.AuthenticationContext)1 SimpleAuthenticationContext (io.gravitee.am.identityprovider.api.SimpleAuthenticationContext)1 Client (io.gravitee.am.model.oidc.Client)1 ContextState (io.quarkus.arc.InjectableContext.ContextState)1 ManagedContext (io.quarkus.arc.ManagedContext)1 SecurityIdentity (io.quarkus.security.identity.SecurityIdentity)1 Session (io.vertx.ext.web.Session)1 MultiMap (io.vertx.reactivex.core.MultiMap)1 Session (io.vertx.reactivex.ext.web.Session)1