List of usage examples for org.springframework.security.oauth2.provider.client ClientCredentialsTokenGranter ClientCredentialsTokenGranter
public ClientCredentialsTokenGranter(AuthorizationServerTokenServices tokenServices,
ClientDetailsService clientDetailsService, OAuth2RequestFactory requestFactory)
From source file:org.meruvian.yama.webapi.config.oauth.OAuthServerConfig.java
@Bean public TokenGranter tokenGranter() { return new ClientCredentialsTokenGranter(tokenServices(), clientDetailsService, requestFactory()); }
From source file:org.osiam.configuration.OAuth2AuthorizationServerConfig.java
@Bean public TokenGranter tokenGranter() throws Exception { return new CompositeTokenGranter(Arrays.asList(new TokenGranter[] { new ClientCredentialsTokenGranter(tokenServices(), osiamClientDetailsService, oAuth2RequestFactory()), new OsiamResourceOwnerPasswordTokenGranter(authenticationManager, tokenServices(), osiamClientDetailsService, oAuth2RequestFactory()), new RefreshTokenGranter(tokenServices(), osiamClientDetailsService, oAuth2RequestFactory()), new LessStrictRedirectUriAuthorizationCodeTokenGranter(tokenServices(), authorizationCodeServices(), osiamClientDetailsService, oAuth2RequestFactory()) })); }
From source file:com.hundsun.sso.controller.OAuthRestController.java
protected TokenGranter getTokenGranter(String grantType) { if ("authorization_code".equals(grantType)) { return new AuthorizationCodeTokenGranter(tokenServices, authorizationCodeServices, clientDetailsService, this.oAuth2RequestFactory); } else if ("password".equals(grantType)) { return new ResourceOwnerPasswordTokenGranter(getAuthenticationManager(), tokenServices, clientDetailsService, this.oAuth2RequestFactory); } else if ("refresh_token".equals(grantType)) { return new RefreshTokenGranter(tokenServices, clientDetailsService, this.oAuth2RequestFactory); } else if ("client_credentials".equals(grantType)) { return new ClientCredentialsTokenGranter(tokenServices, clientDetailsService, this.oAuth2RequestFactory); } else if ("implicit".equals(grantType)) { return new ImplicitTokenGranter(tokenServices, clientDetailsService, this.oAuth2RequestFactory); } else {//from w w w . j ava2s . co m throw new UnsupportedGrantTypeException("Unsupport grant_type: " + grantType); } }
From source file:org.joyrest.oauth2.initializer.OAuth2Initializer.java
private TokenGranter compositeTokenGranter(final ClientDetailsService clientService, final AuthenticationManager manager, final DefaultTokenServices tokenServices, final OAuth2RequestFactory requestFactory, final AuthorizationCodeServices authorizationCodeServices) { List<TokenGranter> granters = new ArrayList<>(); granters.add(new ClientCredentialsTokenGranter(tokenServices, clientService, requestFactory)); granters.add(new ImplicitTokenGranter(tokenServices, clientService, requestFactory)); granters.add(new ResourceOwnerPasswordTokenGranter(manager, tokenServices, clientService, requestFactory)); granters.add(new RefreshTokenGranter(tokenServices, clientService, requestFactory)); granters.add(new AuthorizationCodeTokenGranter(tokenServices, authorizationCodeServices, clientService, requestFactory));/*from w w w. j a v a2 s .c om*/ return new CompositeTokenGranter(granters); }