Example usage for org.springframework.security.oauth2.provider.refresh RefreshTokenGranter RefreshTokenGranter

List of usage examples for org.springframework.security.oauth2.provider.refresh RefreshTokenGranter RefreshTokenGranter

Introduction

In this page you can find the example usage for org.springframework.security.oauth2.provider.refresh RefreshTokenGranter RefreshTokenGranter.

Prototype

public RefreshTokenGranter(AuthorizationServerTokenServices tokenServices,
            ClientDetailsService clientDetailsService, OAuth2RequestFactory requestFactory) 

Source Link

Usage

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 ww.  java  2  s . 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));/*w  ww.  j  ava2  s .  c o  m*/
    return new CompositeTokenGranter(granters);
}