List of usage examples for org.springframework.security.oauth2.provider.password ResourceOwnerPasswordTokenGranter ResourceOwnerPasswordTokenGranter
public ResourceOwnerPasswordTokenGranter(AuthenticationManager authenticationManager,
AuthorizationServerTokenServices tokenServices, 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 w w w . j a va 2s . c om*/ 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));// w w w . j av a2 s . com return new CompositeTokenGranter(granters); }