@Test void testFindByRegistrationId() { String registrationId = "registrationId"; String clientId = "clientId"; String clientName = "clientName"; String clientSecret = "clientSecret"; String clientAuthenticationMethod = "basic"; String authorizationGrantType = "authorization_code"; String authorizationUri = "authorizationUri"; String tokenUri = "tokenUri"; String jwkSetUri = "jwkSetUri"; String[] scopes = new String[] {"openid", "profile", "email"}; String userInfoUri = "userInfoUri"; String usernameAttributeName = "usernameAttributeName"; OidcClient oidcClient = mock(OidcClient.class); when(oidcClient.getRegistrationId()).thenReturn(registrationId); when(oidcClient.getClientId()).thenReturn(clientId); when(oidcClient.getClientName()).thenReturn(clientName); when(oidcClient.getClientSecret()).thenReturn(clientSecret); when(oidcClient.getClientAuthenticationMethod()).thenReturn(clientAuthenticationMethod); when(oidcClient.getAuthorizationGrantType()).thenReturn(authorizationGrantType); when(oidcClient.getAuthorizationUri()).thenReturn(authorizationUri); when(oidcClient.getTokenUri()).thenReturn(tokenUri); when(oidcClient.getJwkSetUri()).thenReturn(jwkSetUri); when(oidcClient.getScopes()).thenReturn(scopes); when(oidcClient.getUserInfoUri()).thenReturn(userInfoUri); when(oidcClient.getUsernameAttributeName()).thenReturn(usernameAttributeName); when(authenticationSettings.getOidcClients()).thenReturn(singleton(oidcClient)); ClientRegistration clientRegistration = dataServiceClientRegistrationRepository.findByRegistrationId(registrationId); assertEquals(registrationId, clientRegistration.getRegistrationId()); assertEquals(clientId, clientRegistration.getClientId()); assertEquals(clientName, clientRegistration.getClientName()); assertEquals(clientSecret, clientRegistration.getClientSecret()); assertEquals(BASIC, clientRegistration.getClientAuthenticationMethod()); assertEquals(AUTHORIZATION_CODE, clientRegistration.getAuthorizationGrantType()); assertEquals(new HashSet<>(asList(scopes)), clientRegistration.getScopes()); ProviderDetails providerDetails = clientRegistration.getProviderDetails(); assertEquals(authorizationUri, providerDetails.getAuthorizationUri()); assertEquals(tokenUri, providerDetails.getTokenUri()); assertEquals(jwkSetUri, providerDetails.getJwkSetUri()); UserInfoEndpoint userInfoEndpoint = providerDetails.getUserInfoEndpoint(); assertEquals(userInfoUri, userInfoEndpoint.getUri()); assertEquals(usernameAttributeName, userInfoEndpoint.getUserNameAttributeName()); assertEquals( "{baseUrl}/login/oauth2/code/{registrationId}", clientRegistration.getRedirectUriTemplate()); }
@Override public ClientRegistration findByRegistrationId(String registrationId) { return runAsSystem( () -> { OidcClient oidcClient = findOidcClient(registrationId); return oidcClient != null ? toClientRegistration(oidcClient) : null; }); }
DataServiceClientRegistrationRepository implements ClientRegistrationRepository { @Override public ClientRegistration findByRegistrationId(String registrationId) { return runAsSystem( () -> { OidcClient oidcClient = findOidcClient(registrationId); return oidcClient != null ? toClientRegistration(oidcClient) : null; }); } }
DataServiceClientRegistrationRepository implements ClientRegistrationRepository { @Override public ClientRegistration findByRegistrationId(String registrationId) { return runAsSystem( () -> { OidcClient oidcClient = findOidcClient(registrationId); return oidcClient != null ? toClientRegistration(oidcClient) : null; }); } DataServiceClientRegistrationRepository(AuthenticationSettings authenticationSettings); }
DataServiceClientRegistrationRepository implements ClientRegistrationRepository { @Override public ClientRegistration findByRegistrationId(String registrationId) { return runAsSystem( () -> { OidcClient oidcClient = findOidcClient(registrationId); return oidcClient != null ? toClientRegistration(oidcClient) : null; }); } DataServiceClientRegistrationRepository(AuthenticationSettings authenticationSettings); @Override ClientRegistration findByRegistrationId(String registrationId); }
DataServiceClientRegistrationRepository implements ClientRegistrationRepository { @Override public ClientRegistration findByRegistrationId(String registrationId) { return runAsSystem( () -> { OidcClient oidcClient = findOidcClient(registrationId); return oidcClient != null ? toClientRegistration(oidcClient) : null; }); } DataServiceClientRegistrationRepository(AuthenticationSettings authenticationSettings); @Override ClientRegistration findByRegistrationId(String registrationId);  }