use of org.springframework.security.oauth2.provider.AuthorizationRequest in project spring-security-oauth by spring-projects.
the class DefaultAuthorizationRequestFactoryTests method testPasswordErased.
@Test
public void testPasswordErased() {
factory.setCheckUserScopes(true);
Map<String, String> params = new HashMap<String, String>(Collections.singletonMap("client_id", "foo"));
params.put("password", "shhh");
AuthorizationRequest auth = factory.createAuthorizationRequest(params);
OAuth2Request request = factory.createTokenRequest(auth, "password").createOAuth2Request(client);
assertNull(request.getRequestParameters().get("password"));
}
use of org.springframework.security.oauth2.provider.AuthorizationRequest in project spring-security-oauth by spring-projects.
the class DefaultAuthorizationRequestFactoryTests method testCreateTokenThenOAuth2RequestWithGrantType.
@Test
public void testCreateTokenThenOAuth2RequestWithGrantType() {
factory.setCheckUserScopes(true);
AuthorizationRequest auth = factory.createAuthorizationRequest(Collections.singletonMap("client_id", "foo"));
OAuth2Request request = factory.createTokenRequest(auth, "password").createOAuth2Request(client);
assertEquals("password", request.getGrantType());
assertEquals("[bar]", request.getResourceIds().toString());
}
use of org.springframework.security.oauth2.provider.AuthorizationRequest in project spring-security-oauth by spring-projects.
the class DefaultOAuth2RequestValidatorTests method testNotPermittedForAuthorization.
@Test(expected = InvalidScopeException.class)
public void testNotPermittedForAuthorization() {
AuthorizationRequest request = factory.createAuthorizationRequest(params);
request.setScope(Collections.singleton("foo"));
validator.validateScope(request, client);
}
use of org.springframework.security.oauth2.provider.AuthorizationRequest in project spring-security-oauth by spring-projects.
the class OAuth2RequestTests method testBaseMethods.
@Test
public void testBaseMethods() throws Exception {
parameters.put("response_type", "token");
OAuth2Request authorizationRequest = createFromParameters(parameters);
assertEquals("theClient", authorizationRequest.getClientId());
}
use of org.springframework.security.oauth2.provider.AuthorizationRequest in project spring-security-oauth by spring-projects.
the class ClientScopeVoterTests method init.
@Before
public void init() {
AuthorizationRequest authorizationRequest = new AuthorizationRequest();
authorizationRequest.setClientId("client");
authorizationRequest.setScope(Arrays.asList("read", "write"));
authentication = new OAuth2Authentication(authorizationRequest.createOAuth2Request(), userAuthentication);
InMemoryClientDetailsService clientDetailsService = new InMemoryClientDetailsService();
client = new BaseClientDetails("client", "source", "read,write", "authorization_code,client_credentials", "read");
clientDetailsService.setClientDetailsStore(Collections.singletonMap("client", client));
voter.setClientDetailsService(clientDetailsService);
}
Aggregations