Search in sources :

Example 6 with OAuth2AuthProviderImpl

use of io.vertx.ext.auth.oauth2.impl.OAuth2AuthProviderImpl in project vertx-auth by vert-x3.

the class Oauth2TokenTest method testNullScope.

@Test
public void testNullScope() throws Exception {
    super.setUp();
    oauth2 = KeycloakAuth.create(vertx, OAuth2FlowType.AUTH_CODE, keycloakConfig);
    JsonObject json = new JsonObject("{\n" + "    \"access_token\":\"xyz\",\n" + "    \"expires_in\":60,\n" + "    \"token_type\":\"bearer\",\n" + "    \"not-before-policy\":0,\n" + "    \"scope\":null\n" + "}");
    try {
        OAuth2TokenImpl token = new OAuth2TokenImpl((OAuth2AuthProviderImpl) oauth2, json);
    } catch (RuntimeException e) {
        fail();
    }
}
Also used : JsonObject(io.vertx.core.json.JsonObject) OAuth2TokenImpl(io.vertx.ext.auth.oauth2.impl.OAuth2TokenImpl) Test(org.junit.Test)

Example 7 with OAuth2AuthProviderImpl

use of io.vertx.ext.auth.oauth2.impl.OAuth2AuthProviderImpl in project vertx-auth by vert-x3.

the class Oauth2TokenTest method keycloakTest.

@Test
public void keycloakTest() throws Exception {
    super.setUp();
    oauth2 = KeycloakAuth.create(vertx, OAuth2FlowType.AUTH_CODE, keycloakConfig);
    OAuth2TokenImpl token = new OAuth2TokenImpl((OAuth2AuthProviderImpl) oauth2, keycloakToken);
    assertNotNull(token.opaqueAccessToken());
    assertNotNull(token.opaqueRefreshToken());
    assertNull(token.accessToken());
    // trust it
    token.setTrustJWT(true);
    assertNotNull(token.accessToken());
}
Also used : OAuth2TokenImpl(io.vertx.ext.auth.oauth2.impl.OAuth2TokenImpl) Test(org.junit.Test)

Aggregations

OAuth2TokenImpl (io.vertx.ext.auth.oauth2.impl.OAuth2TokenImpl)6 JsonObject (io.vertx.core.json.JsonObject)5 Test (org.junit.Test)4 OAuth2AuthProviderImpl (io.vertx.ext.auth.oauth2.impl.OAuth2AuthProviderImpl)3 AccessToken (io.vertx.ext.auth.oauth2.AccessToken)2 AccessToken (io.vertx.reactivex.ext.auth.oauth2.AccessToken)2 PubSecKeyOptions (io.vertx.ext.auth.PubSecKeyOptions)1 Session (io.vertx.reactivex.ext.web.Session)1