Search in sources :

Example 1 with InMemoryClientDetailsService

use of org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService in project spring-security-oauth by spring-projects.

the class InMemoryClientDetailsServiceBuilder method performBuild.

@Override
protected ClientDetailsService performBuild() {
    InMemoryClientDetailsService clientDetailsService = new InMemoryClientDetailsService();
    clientDetailsService.setClientDetailsStore(clientDetails);
    return clientDetailsService;
}
Also used : InMemoryClientDetailsService(org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService)

Example 2 with InMemoryClientDetailsService

use of org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService in project spring-security-oauth by spring-projects.

the class ApprovalStoreUserApprovalHandlerTests method init.

@Before
public void init() {
    handler.setApprovalStore(store);
    InMemoryClientDetailsService clientDetailsService = new InMemoryClientDetailsService();
    Map<String, ClientDetails> map = new HashMap<String, ClientDetails>();
    map.put("client", new BaseClientDetails("client", null, "read,write", "authorization_code", null));
    clientDetailsService.setClientDetailsStore(map);
    handler.setRequestFactory(new DefaultOAuth2RequestFactory(clientDetailsService));
    userAuthentication = new UsernamePasswordAuthenticationToken("user", "N/A", AuthorityUtils.commaSeparatedStringToAuthorityList("USER"));
}
Also used : InMemoryClientDetailsService(org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService) BaseClientDetails(org.springframework.security.oauth2.provider.client.BaseClientDetails) DefaultOAuth2RequestFactory(org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory) BaseClientDetails(org.springframework.security.oauth2.provider.client.BaseClientDetails) ClientDetails(org.springframework.security.oauth2.provider.ClientDetails) HashMap(java.util.HashMap) UsernamePasswordAuthenticationToken(org.springframework.security.authentication.UsernamePasswordAuthenticationToken) Before(org.junit.Before)

Example 3 with InMemoryClientDetailsService

use of org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService 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);
}
Also used : InMemoryClientDetailsService(org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService) BaseClientDetails(org.springframework.security.oauth2.provider.client.BaseClientDetails) AuthorizationRequest(org.springframework.security.oauth2.provider.AuthorizationRequest) OAuth2Authentication(org.springframework.security.oauth2.provider.OAuth2Authentication) Before(org.junit.Before)

Aggregations

InMemoryClientDetailsService (org.springframework.security.oauth2.provider.client.InMemoryClientDetailsService)3 Before (org.junit.Before)2 BaseClientDetails (org.springframework.security.oauth2.provider.client.BaseClientDetails)2 HashMap (java.util.HashMap)1 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)1 AuthorizationRequest (org.springframework.security.oauth2.provider.AuthorizationRequest)1 ClientDetails (org.springframework.security.oauth2.provider.ClientDetails)1 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)1 DefaultOAuth2RequestFactory (org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory)1