• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResourceOwnerPasswordTokenGranter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter的典型用法代码示例。如果您正苦于以下问题:Java ResourceOwnerPasswordTokenGranter类的具体用法?Java ResourceOwnerPasswordTokenGranter怎么用?Java ResourceOwnerPasswordTokenGranter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ResourceOwnerPasswordTokenGranter类属于org.springframework.security.oauth2.provider.password包,在下文中一共展示了ResourceOwnerPasswordTokenGranter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getCustomizedTokenGranters

import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter; //导入依赖的package包/类
private List<TokenGranter> getCustomizedTokenGranters() {
    AuthorizationServerTokenServices tokenServices = tokenServices();
    ClientDetailsService clientDetails = clientDetailsService();
    AuthorizationCodeServices authorizationCodeServices = authorizationCodeServices();
    OAuth2RequestFactory requestFactory = new DefaultOAuth2RequestFactory(clientDetails);

    AuthorizationCodeTokenGranter authorizationCodeTokenGranter = new AuthorizationCodeTokenGranter(tokenServices, authorizationCodeServices, clientDetails, requestFactory);
    RefreshTokenGranter refreshTokenGranter = new RefreshTokenGranter(tokenServices, clientDetails, requestFactory);
    ImplicitTokenGranter implicit = new ImplicitTokenGranter(tokenServices, clientDetails, requestFactory);
    ClientCredentialsTokenGranter clientCredentialsTokenGranter = new ClientCredentialsTokenGranter(tokenServices, clientDetails, requestFactory);
    clientCredentialsTokenGranter.setAllowRefresh(true);//custom config, see AuthorizationServerEndpointsConfigurer.getDefaultTokenGranters

    List<TokenGranter> tokenGranters = new ArrayList<>();
    tokenGranters.add(authorizationCodeTokenGranter);
    tokenGranters.add(refreshTokenGranter);
    tokenGranters.add(implicit);
    tokenGranters.add(clientCredentialsTokenGranter);
    if (authenticationManager != null) {
        tokenGranters.add(new ResourceOwnerPasswordTokenGranter(authenticationManager, tokenServices, clientDetails, requestFactory));
    }

    return tokenGranters;
}
 
开发者ID:openmg,项目名称:metagraph-auth,代码行数:24,代码来源:AuthorizationServerConfigurer.java


示例2: configure

import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter; //导入依赖的package包/类
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
    DefaultOAuth2RequestFactory requestFactory = new DefaultOAuth2RequestFactory(clientDetailsService);

    endpoints
            .tokenStore(tokenStore)
            .authenticationManager(authenticationManager)
            .tokenServices(authorizationServerTokenServices)
            .requestFactory(requestFactory)
            .tokenEnhancer(tokenEnhancer)
            .tokenGranter(
                    new CompositeTokenGranter(Arrays.asList(
                            new ResourceOwnerPasswordTokenGranter(
                                    authenticationManager,
                                    authorizationServerTokenServices,
                                    clientDetailsService,
                                    requestFactory
                            ),
                            new RefreshTokenGranter(
                                    authorizationServerTokenServices,
                                    clientDetailsService,
                                    requestFactory)
                    ))
            )
    ;
}
 
开发者ID:sys-devel-d,项目名称:pimp,代码行数:27,代码来源:OAuthConfig.java


示例3: getTokenGranter

import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter; //导入依赖的package包/类
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 {
            throw new UnsupportedGrantTypeException("Unsupport grant_type: " + grantType);
        }
    }
 
开发者ID:yjmyzz,项目名称:spring-oauth-server,代码行数:17,代码来源:OAuthRestController.java


示例4: tokenGranter

import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter; //导入依赖的package包/类
@Bean
public TokenGranter tokenGranter() {

    DefaultOAuth2RequestFactory requestFactory = new DefaultOAuth2RequestFactory(clientDetailsService());

    AuthorizationCodeServices codeServices = authorizationCodeServices();

    AuthorizationServerTokenServices tokenServices = tokenServices();
    List<TokenGranter> tokenGranters = Arrays.asList(
            new CustomAuthCodeTokenGranter(tokenServices, codeServices, clientDetailsService(), requestFactory),
            new ResourceOwnerPasswordTokenGranter(authenticationManager, tokenServices, clientDetailsService(), requestFactory),
            new ImplicitTokenGranter(tokenServices, clientDetailsService(), requestFactory));

    return new CompositeTokenGranter(tokenGranters);
}
 
开发者ID:PacktPublishing,项目名称:OAuth-2.0-Cookbook,代码行数:16,代码来源:OAuth2Configuration.java


示例5: tokenGranter

import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter; //导入依赖的package包/类
@Bean
TokenGranter tokenGranter() {
    List<TokenGranter> tokenGranters = Lists.newArrayList();
    ResourceOwnerPasswordTokenGranter resourceOwnerPasswordTokenGranter = new ResourceOwnerPasswordTokenGranter(am,getDefaultTokenServices()
    ,getClientDetailsService(),new DefaultOAuth2RequestFactory(getClientDetailsService()));
    ClientCredentialsTokenGranter clientCredentialsTokenGranter = new ClientCredentialsTokenGranter(getDefaultTokenServices(),getClientDetailsService(),new DefaultOAuth2RequestFactory(getClientDetailsService()));
    AuthorizationCodeTokenGranter authorizationCodeTokenGranter = new AuthorizationCodeTokenGranter(getDefaultTokenServices(),authorizationCodeServices(),getClientDetailsService(),new DefaultOAuth2RequestFactory(getClientDetailsService()));
    ImplicitTokenGranter implicitTokenGranter = new ImplicitTokenGranter(getDefaultTokenServices(),getClientDetailsService(),new DefaultOAuth2RequestFactory(getClientDetailsService()));
    tokenGranters.add(resourceOwnerPasswordTokenGranter);
    tokenGranters.add(clientCredentialsTokenGranter);
    tokenGranters.add(authorizationCodeTokenGranter);
    tokenGranters.add(implicitTokenGranter);
    return new CompositeTokenGranter(tokenGranters);
}
 
开发者ID:AgainstWind,项目名称:spring-cloud-demos,代码行数:15,代码来源:TestAuthorizationConfig.java


示例6: compositeTokenGranter

import org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter; //导入依赖的package包/类
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));
    return new CompositeTokenGranter(granters);
}
 
开发者ID:petrbouda,项目名称:joyrest,代码行数:15,代码来源:OAuth2Initializer.java



注:本文中的org.springframework.security.oauth2.provider.password.ResourceOwnerPasswordTokenGranter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TransactionBroadcast类代码示例发布时间:2022-05-23
下一篇:
Java Navigator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap