use of org.springframework.security.oauth2.provider.ClientDetails in project spring-security-oauth by spring-projects.
the class JdbcClientDetailsServiceTests method testRemoveClient.
@Test
public void testRemoveClient() {
BaseClientDetails clientDetails = new BaseClientDetails();
clientDetails.setClientId("deletedClientIdWithNoDetails");
service.addClientDetails(clientDetails);
service.removeClientDetails(clientDetails.getClientId());
int count = jdbcTemplate.queryForObject("select count(*) from oauth_client_details where client_id=?", Integer.class, "deletedClientIdWithNoDetails");
assertEquals(0, count);
}
use of org.springframework.security.oauth2.provider.ClientDetails in project spring-security-oauth by spring-projects.
the class JdbcClientDetailsServiceTests method testInsertDuplicateClient.
@Test(expected = ClientAlreadyExistsException.class)
public void testInsertDuplicateClient() {
BaseClientDetails clientDetails = new BaseClientDetails();
clientDetails.setClientId("duplicateClientIdWithNoDetails");
service.addClientDetails(clientDetails);
service.addClientDetails(clientDetails);
}
use of org.springframework.security.oauth2.provider.ClientDetails in project spring-security-oauth by spring-projects.
the class JdbcClientDetailsServiceTests method testLoadingClientIdWithAdditionalInformation.
@Test
public void testLoadingClientIdWithAdditionalInformation() {
jdbcTemplate.update(INSERT_SQL, "clientIdWithAddInfo", null, null, null, null, null, null, null, null, null);
jdbcTemplate.update("update oauth_client_details set additional_information=? where client_id=?", "{\"foo\":\"bar\"}", "clientIdWithAddInfo");
ClientDetails clientDetails = service.loadClientByClientId("clientIdWithAddInfo");
assertEquals("clientIdWithAddInfo", clientDetails.getClientId());
assertEquals(Collections.singletonMap("foo", "bar"), clientDetails.getAdditionalInformation());
}
use of org.springframework.security.oauth2.provider.ClientDetails in project spring-security-oauth by spring-projects.
the class JdbcClientDetailsServiceTests method testFindClients.
@Test
public void testFindClients() {
BaseClientDetails clientDetails = new BaseClientDetails();
clientDetails.setClientId("aclient");
service.addClientDetails(clientDetails);
int count = service.listClientDetails().size();
assertEquals(1, count);
}
use of org.springframework.security.oauth2.provider.ClientDetails in project spring-security-oauth by spring-projects.
the class JdbcClientDetailsServiceTests method testLoadingClientIdWithNoDetails.
@Test
public void testLoadingClientIdWithNoDetails() {
jdbcTemplate.update(INSERT_SQL, "clientIdWithNoDetails", null, null, null, null, null, null, null, null, null);
ClientDetails clientDetails = service.loadClientByClientId("clientIdWithNoDetails");
assertEquals("clientIdWithNoDetails", clientDetails.getClientId());
assertFalse(clientDetails.isSecretRequired());
assertNull(clientDetails.getClientSecret());
assertFalse(clientDetails.isScoped());
assertEquals(0, clientDetails.getScope().size());
assertEquals(2, clientDetails.getAuthorizedGrantTypes().size());
assertNull(clientDetails.getRegisteredRedirectUri());
assertEquals(0, clientDetails.getAuthorities().size());
assertEquals(null, clientDetails.getAccessTokenValiditySeconds());
assertEquals(null, clientDetails.getAccessTokenValiditySeconds());
}
Aggregations