本文整理汇总了Java中org.springframework.security.oauth2.provider.CompositeTokenGranter类的典型用法代码示例。如果您正苦于以下问题:Java CompositeTokenGranter类的具体用法?Java CompositeTokenGranter怎么用?Java CompositeTokenGranter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CompositeTokenGranter类属于org.springframework.security.oauth2.provider包,在下文中一共展示了CompositeTokenGranter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configure
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的package包/类
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints)
throws Exception {
endpoints.tokenStore(tokenStore())
.tokenEnhancer(jwtTokenEnhancer())
.authenticationManager(authenticationManager)
.userDetailsService(userDetailsService);
List<TokenGranter> tokenGranters = new ArrayList<>();
tokenGranters
.add(new CustomResourceOwnerPasswordTokenGranter(authenticationManager,
endpoints.getTokenServices(), endpoints.getClientDetailsService(),
endpoints.getOAuth2RequestFactory()));
tokenGranters.add(new RefreshTokenGranter(endpoints.getTokenServices(),
endpoints.getClientDetailsService(),
endpoints.getOAuth2RequestFactory()));
endpoints.tokenGranter(new CompositeTokenGranter(tokenGranters));
}
示例2: configure
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的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)
))
)
;
}
示例3: tokenGranter
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的package包/类
@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()
)
}));
}
示例4: tokenGranter
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的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);
}
示例5: compositeTokenGranter
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的package包/类
private TokenGranter compositeTokenGranter(AuthorizationServerEndpointsConfigurer endpoints) {
TokenGranter mobileIdTokenGranter = mobileIdTokenGranter(endpoints);
TokenGranter idCardTokenGranter = idCardTokenGranter(endpoints);
TokenGranter refreshTokenGranter = new RefreshTokenGranter(
endpoints.getTokenServices(), clientDetailsService(), endpoints.getOAuth2RequestFactory());
TokenGranter clientCredentialsTokenGranter =
new ClientCredentialsTokenGranter(
endpoints.getTokenServices(), clientDetailsService(), endpoints.getOAuth2RequestFactory());
return new CompositeTokenGranter(asList(mobileIdTokenGranter, idCardTokenGranter,
refreshTokenGranter, clientCredentialsTokenGranter));
}
示例6: configure
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的package包/类
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.authenticationManager(authenticationManager)//for password grant type to load user info
.authorizationCodeServices(authorizationCodeServices())//for AuthorizationEndPoint to create code
.tokenGranter(new CompositeTokenGranter(getCustomizedTokenGranters()))//custom token granters
.tokenServices(tokenServices())//for refresh_token grant type, setSupportRefreshToken to be true
.approvalStore(approvalStore());
}
示例7: tokenGranter
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的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);
}
示例8: tokenGranter
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的package包/类
private TokenGranter tokenGranter(final AuthorizationServerEndpointsConfigurer endpoints) {
List<TokenGranter> granters = new ArrayList<>(Arrays.asList(endpoints.getTokenGranter()));
extensionGrantManager.providers().forEach((id, tokenGranterProvider) -> {
CustomTokenGranter customTokenGranter = new CustomTokenGranter(endpoints.getTokenServices(), endpoints.getClientDetailsService(), endpoints.getOAuth2RequestFactory(), extensionGrantManager.getTokenGranter(id));
customTokenGranter.setExtensionGrantProvider(tokenGranterProvider);
customTokenGranter.setAuthenticationEventPublisher(new DefaultAuthenticationEventPublisher(applicationEventPublisher));
granters.add(customTokenGranter);
});
return new CompositeTokenGranter(granters);
}
开发者ID:gravitee-io,项目名称:graviteeio-access-management,代码行数:11,代码来源:AuthorizationServerConfiguration.java
示例9: compositeTokenGranter
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的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);
}
示例10: testCustomGrantRegistered
import org.springframework.security.oauth2.provider.CompositeTokenGranter; //导入依赖的package包/类
@Test
public void testCustomGrantRegistered() {
TokenGranter granter = context.getBean(CompositeTokenGranter.class);
assertNotNull("Custom grant registration failed!", granter.grant("test-grant", null));
}