use of org.cloudfoundry.identity.uaa.zone.MultitenantJdbcClientDetailsService in project uaa by cloudfoundry.
the class UaaClientAuthenticationProviderTest method setUpForClientTests.
@BeforeEach
void setUpForClientTests() {
IdentityZoneManager mockIdentityZoneManager = mock(IdentityZoneManager.class);
when(mockIdentityZoneManager.getCurrentIdentityZoneId()).thenReturn(IdentityZone.getUaaZoneId());
jdbcClientDetailsService = new MultitenantJdbcClientDetailsService(jdbcTemplate, mockIdentityZoneManager, passwordEncoder);
ClientDetailsUserDetailsService clientDetailsService = new ClientDetailsUserDetailsService(jdbcClientDetailsService);
client = createClient();
authenticationProvider = new ClientDetailsAuthenticationProvider(clientDetailsService, passwordEncoder);
}
use of org.cloudfoundry.identity.uaa.zone.MultitenantJdbcClientDetailsService in project uaa by cloudfoundry.
the class ClientAdminBootstrapTests method setUpClientAdminTests.
@BeforeEach
void setUpClientAdminTests() {
randomValueStringGenerator = new RandomValueStringGenerator();
IdentityZoneManager mockIdentityZoneManager = mock(IdentityZoneManager.class);
when(mockIdentityZoneManager.getCurrentIdentityZoneId()).thenReturn(IdentityZone.getUaaZoneId());
multitenantJdbcClientDetailsService = spy(new MultitenantJdbcClientDetailsService(jdbcTemplate, mockIdentityZoneManager, passwordEncoder));
clientMetadataProvisioning = new JdbcClientMetadataProvisioning(multitenantJdbcClientDetailsService, jdbcTemplate);
autoApproveId = "autoapprove-" + randomValueStringGenerator.generate().toLowerCase();
clients = new HashMap<>();
clientAdminBootstrap = new ClientAdminBootstrap(passwordEncoder, multitenantJdbcClientDetailsService, clientMetadataProvisioning, true, clients, Collections.singleton(autoApproveId), Collections.emptySet(), null);
mockApplicationEventPublisher = mock(ApplicationEventPublisher.class);
clientAdminBootstrap.setApplicationEventPublisher(mockApplicationEventPublisher);
}
use of org.cloudfoundry.identity.uaa.zone.MultitenantJdbcClientDetailsService in project uaa by cloudfoundry.
the class TokenRevocationEndpointTests method setupForTokenRevocation.
@BeforeEach
void setupForTokenRevocation() {
String zoneId = IdentityZoneHolder.get().getId();
RandomValueStringGenerator generator = new RandomValueStringGenerator();
String clientId = generator.generate().toLowerCase();
client = new BaseClientDetails(clientId, "", "some.scopes", "client_credentials", "authorities");
client.addAdditionalInformation(TOKEN_SALT, "pre-salt");
IdentityZoneManager mockIdentityZoneManager = mock(IdentityZoneManager.class);
when(mockIdentityZoneManager.getCurrentIdentityZoneId()).thenReturn(IdentityZone.getUaaZoneId());
clientService = spy(new MultitenantJdbcClientDetailsService(jdbcTemplate, mockIdentityZoneManager, passwordEncoder));
clientService.addClientDetails(client, zoneId);
ScimUserProvisioning userProvisioning = new JdbcScimUserProvisioning(jdbcTemplate, new JdbcPagingListFactory(jdbcTemplate, limitSqlAdapter), passwordEncoder);
JdbcRevocableTokenProvisioning provisioning = spy(new JdbcRevocableTokenProvisioning(jdbcTemplate, limitSqlAdapter, new TimeServiceImpl()));
endpoint = spy(new TokenRevocationEndpoint(clientService, userProvisioning, provisioning));
ApplicationEventPublisher publisher = mock(ApplicationEventPublisher.class);
endpoint.setApplicationEventPublisher(publisher);
SecurityContextHolder.getContext().setAuthentication(new UaaOauth2Authentication("token-value", zoneId, mock(OAuth2Request.class), new UaaAuthentication(new UaaPrincipal("id", "username", "username@test.com", OriginKeys.UAA, "", zoneId), Collections.emptyList(), mock(UaaAuthenticationDetails.class))));
provisioning.create(new RevocableToken().setClientId(client.getClientId()).setTokenId("token-id").setUserId(null).setResponseType(RevocableToken.TokenType.ACCESS_TOKEN).setValue("value").setIssuedAt(System.currentTimeMillis()), zoneId);
}
use of org.cloudfoundry.identity.uaa.zone.MultitenantJdbcClientDetailsService in project uaa by cloudfoundry.
the class JdbcQueryableClientDetailsServiceTests method setUp.
@BeforeEach
void setUp() {
multitenantJdbcClientDetailsService = new MultitenantJdbcClientDetailsService(jdbcTemplate, null, passwordEncoder);
jdbcQueryableClientDetailsService = new JdbcQueryableClientDetailsService(multitenantJdbcClientDetailsService, jdbcTemplate, new JdbcPagingListFactory(jdbcTemplate, limitSqlAdapter));
}
use of org.cloudfoundry.identity.uaa.zone.MultitenantJdbcClientDetailsService in project uaa by cloudfoundry.
the class MockMvcUtils method createClient.
public static BaseClientDetails createClient(ApplicationContext context, BaseClientDetails clientDetails, IdentityZone zone) {
MultitenantJdbcClientDetailsService service = context.getBean(MultitenantJdbcClientDetailsService.class);
service.addClientDetails(clientDetails, zone.getId());
return (BaseClientDetails) service.loadClientByClientId(clientDetails.getClientId(), zone.getId());
}
Aggregations