本文整理汇总了Java中org.springframework.security.oauth2.provider.code.AuthorizationCodeTokenGranter类的典型用法代码示例。如果您正苦于以下问题:Java AuthorizationCodeTokenGranter类的具体用法?Java AuthorizationCodeTokenGranter怎么用?Java AuthorizationCodeTokenGranter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthorizationCodeTokenGranter类属于org.springframework.security.oauth2.provider.code包,在下文中一共展示了AuthorizationCodeTokenGranter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCustomizedTokenGranters
import org.springframework.security.oauth2.provider.code.AuthorizationCodeTokenGranter; //导入依赖的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: getTokenGranter
import org.springframework.security.oauth2.provider.code.AuthorizationCodeTokenGranter; //导入依赖的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
示例3: tokenGranter
import org.springframework.security.oauth2.provider.code.AuthorizationCodeTokenGranter; //导入依赖的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
示例4: compositeTokenGranter
import org.springframework.security.oauth2.provider.code.AuthorizationCodeTokenGranter; //导入依赖的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.code.AuthorizationCodeTokenGranter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论