List of usage examples for org.springframework.security.oauth2.provider.code AuthorizationCodeTokenGranter AuthorizationCodeTokenGranter
public AuthorizationCodeTokenGranter(AuthorizationServerTokenServices tokenServices,
AuthorizationCodeServices authorizationCodeServices, ClientDetailsService clientDetailsService,
OAuth2RequestFactory requestFactory)
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 ww w . j av a 2 s. c o 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 ww w.j a va2 s .co m return new CompositeTokenGranter(granters); }