Search in sources :

Example 1 with OpenIDClientRepository

use of oidc.repository.OpenIDClientRepository in project OpenConext-oidcng by OpenConext.

the class AuthorizationEndpointUnitTest method doValidateScope.

@SuppressWarnings("unchecked")
private void doValidateScope(String clientScope, String requestResponseScope) throws IOException, ParseException {
    AuthorizationRequest authorizationRequest = authorizationRequest(new FluentMap<String, String>().p("client_id", "http://oidc-rp").p("response_type", "code").p("scope", requestResponseScope));
    OpenIDClient client = openIDClient("http://redirect", clientScope, "authorization_code");
    OpenIDClientRepository openIDClientRepository = mock(OpenIDClientRepository.class);
    when(openIDClientRepository.findByClientIdIn(null)).thenReturn(Collections.singletonList(openIDClient("http://redirect", clientScope, "authorization_code")));
    List<String> scopes = AuthorizationEndpoint.validateScopes(openIDClientRepository, new Scope(requestResponseScope), client);
    assertEquals(singletonList(requestResponseScope), scopes);
}
Also used : AuthorizationRequest(com.nimbusds.oauth2.sdk.AuthorizationRequest) Scope(com.nimbusds.oauth2.sdk.Scope) OpenIDClient(oidc.model.OpenIDClient) OpenIDClientRepository(oidc.repository.OpenIDClientRepository)

Aggregations

AuthorizationRequest (com.nimbusds.oauth2.sdk.AuthorizationRequest)1 Scope (com.nimbusds.oauth2.sdk.Scope)1 OpenIDClient (oidc.model.OpenIDClient)1 OpenIDClientRepository (oidc.repository.OpenIDClientRepository)1