Search in sources :

Example 1 with OAuth2Config

use of io.trino.server.security.oauth2.OAuth2Config in project trino by trinodb.

the class TestDynamicCallbackOAuth2Service method testMultipleScopes.

@Test
public void testMultipleScopes() throws Exception {
    DynamicCallbackOAuth2Service service = new DynamicCallbackOAuth2Service(new OAuth2Config().setIssuer(hydraUrl).setAuthUrl(hydraUrl + "/oauth2/auth").setTokenUrl(hydraUrl + "/oauth2/token").setJwksUrl(hydraUrl + "/.well-known/jwks.json").setClientId(CLIENT_ID).setClientSecret(CLIENT_SECRET).setScopes("openid,offline"), httpClient);
    OAuth2AccessToken token = service.getAccessTokenClientCredentialsGrant();
    Claims claims = newJwtParserBuilder().setSigningKeyResolver(signingKeyResolver).build().parseClaimsJws(token.getAccessToken()).getBody();
    assertThat(claims.get("scp", List.class)).containsExactlyInAnyOrder("openid", "offline");
}
Also used : Claims(io.jsonwebtoken.Claims) OAuth2AccessToken(com.github.scribejava.core.model.OAuth2AccessToken) DynamicCallbackOAuth2Service(io.trino.server.security.oauth2.ScribeJavaOAuth2Client.DynamicCallbackOAuth2Service) Test(org.testng.annotations.Test)

Aggregations

OAuth2AccessToken (com.github.scribejava.core.model.OAuth2AccessToken)1 Claims (io.jsonwebtoken.Claims)1 DynamicCallbackOAuth2Service (io.trino.server.security.oauth2.ScribeJavaOAuth2Client.DynamicCallbackOAuth2Service)1 Test (org.testng.annotations.Test)1