use of org.springframework.security.oauth2.provider.client.BaseClientDetails in project spring-security-oauth by spring-projects.
the class BaseClientDetailsTests method testBaseClientDetailsImplicitAutoApprove.
@Test
public void testBaseClientDetailsImplicitAutoApprove() {
BaseClientDetails details = new BaseClientDetails("foo", "", "foo,bar", "authorization_code", "ROLE_USER");
details.setAutoApproveScopes(StringUtils.commaDelimitedListToSet("true"));
assertTrue(details.isAutoApprove("read"));
}
use of org.springframework.security.oauth2.provider.client.BaseClientDetails in project spring-security-oauth by spring-projects.
the class BaseClientDetailsTests method testJsonDeserialize.
@Test
public void testJsonDeserialize() throws Exception {
String value = "{\"foo\":\"bar\",\"client_id\":\"foo\",\"scope\":[\"bar\",\"foo\"],\"authorized_grant_types\":[\"authorization_code\"],\"authorities\":[\"ROLE_USER\"]}";
BaseClientDetails details = new ObjectMapper().readValue(value, BaseClientDetails.class);
BaseClientDetails expected = new BaseClientDetails("foo", "", "foo,bar", "authorization_code", "ROLE_USER");
expected.setAdditionalInformation(Collections.singletonMap("foo", (Object) "bar"));
assertEquals(expected, details);
}
use of org.springframework.security.oauth2.provider.client.BaseClientDetails in project spring-security-oauth by spring-projects.
the class BaseClientDetailsTests method testBaseClientDetailsConvenienceConstructor.
/**
* test explicit convenience constructor
*/
@Test
public void testBaseClientDetailsConvenienceConstructor() {
BaseClientDetails details = new BaseClientDetails("foo", "", "foo,bar", "authorization_code", "ROLE_USER");
assertEquals("[]", details.getResourceIds().toString());
assertEquals("[bar, foo]", details.getScope().toString());
assertEquals("[authorization_code]", details.getAuthorizedGrantTypes().toString());
assertEquals("[ROLE_USER]", details.getAuthorities().toString());
}
use of org.springframework.security.oauth2.provider.client.BaseClientDetails in project spring-security-oauth by spring-projects.
the class BaseClientDetailsTests method testBaseClientDetailsAutoApprove.
/**
* test explicit autoapprove
*/
@Test
public void testBaseClientDetailsAutoApprove() {
BaseClientDetails details = new BaseClientDetails("foo", "", "foo,bar", "authorization_code", "ROLE_USER");
details.setAutoApproveScopes(StringUtils.commaDelimitedListToSet("read,write"));
assertTrue(details.isAutoApprove("read"));
}
use of org.springframework.security.oauth2.provider.client.BaseClientDetails in project spring-security-oauth by spring-projects.
the class BaseClientDetailsTests method testEqualityOfValidity.
/**
* test equality
*/
@Test
public void testEqualityOfValidity() {
BaseClientDetails details = new BaseClientDetails();
details.setAccessTokenValiditySeconds(100);
BaseClientDetails other = new BaseClientDetails();
other.setAccessTokenValiditySeconds(100);
assertEquals(details, other);
}
Aggregations