Search in sources :

Example 1 with DefaultOAuth2RequestFactory

use of org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory in project spring-security-oauth by spring-projects.

the class AbstractEndpoint method afterPropertiesSet.

public void afterPropertiesSet() throws Exception {
    Assert.state(tokenGranter != null, "TokenGranter must be provided");
    Assert.state(clientDetailsService != null, "ClientDetailsService must be provided");
    defaultOAuth2RequestFactory = new DefaultOAuth2RequestFactory(getClientDetailsService());
    if (oAuth2RequestFactory == null) {
        oAuth2RequestFactory = defaultOAuth2RequestFactory;
    }
}
Also used : DefaultOAuth2RequestFactory(org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory)

Example 2 with DefaultOAuth2RequestFactory

use of org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory in project ORCID-Source by ORCID.

the class OrcidClientCredentialsCheckerTest method setup.

@Before
public void setup() {
    MockitoAnnotations.initMocks(this);
    oAuth2RequestFactory = new DefaultOAuth2RequestFactory(clientDetailsService);
    checker = new OrcidClientCredentialsChecker(oAuth2RequestFactory);
    checker.setClientDetailsEntityCacheManager(clientDetailsEntityCacheManager);
    checker.setOrcidOAuth2RequestValidator(orcidOAuth2RequestValidator);
}
Also used : DefaultOAuth2RequestFactory(org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory) Before(org.junit.Before)

Example 3 with DefaultOAuth2RequestFactory

use of org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory 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)

Aggregations

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