use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class AbstractIntegrationTests method clear.
private void clear(ApprovalStore approvalStore) throws Exception {
if (approvalStore instanceof Advised) {
Advised advised = (Advised) tokenStore;
ApprovalStore target = (ApprovalStore) advised.getTargetSource().getTarget();
clear(target);
return;
}
if (approvalStore instanceof InMemoryApprovalStore) {
((InMemoryApprovalStore) approvalStore).clear();
}
if (approvalStore instanceof JdbcApprovalStore) {
JdbcTemplate template = new JdbcTemplate(dataSource);
template.execute("delete from oauth_approvals");
}
}
use of org.springframework.security.oauth2.provider.token.TokenStore in project paascloud-master by paascloud.
the class PcAuthorizationServerConfig method configure.
/**
* Configure.
*
* @param endpoints the endpoints
*
* @throws Exception the exception
*/
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
endpoints.tokenStore(tokenStore).authenticationManager(authenticationManager).userDetailsService(userDetailsService);
if (jwtAccessTokenConverter != null && jwtTokenEnhancer != null) {
TokenEnhancerChain enhancerChain = new TokenEnhancerChain();
List<TokenEnhancer> enhancers = new ArrayList<>();
enhancers.add(jwtTokenEnhancer);
enhancers.add(jwtAccessTokenConverter);
enhancerChain.setTokenEnhancers(enhancers);
endpoints.tokenEnhancer(enhancerChain).accessTokenConverter(jwtAccessTokenConverter);
}
}
use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class AuthorizationServerEndpointsConfigurer method createDefaultTokenServices.
private DefaultTokenServices createDefaultTokenServices() {
DefaultTokenServices tokenServices = new DefaultTokenServices();
tokenServices.setTokenStore(tokenStore());
tokenServices.setSupportRefreshToken(true);
tokenServices.setReuseRefreshToken(reuseRefreshToken);
tokenServices.setClientDetailsService(clientDetailsService());
tokenServices.setTokenEnhancer(tokenEnhancer());
addUserDetailsService(tokenServices, this.userDetailsService);
return tokenServices;
}
use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class AuthorizationServerEndpointsConfigurer method approvalStore.
private ApprovalStore approvalStore() {
if (approvalStore == null && tokenStore() != null && !isApprovalStoreDisabled()) {
TokenApprovalStore tokenApprovalStore = new TokenApprovalStore();
tokenApprovalStore.setTokenStore(tokenStore());
this.approvalStore = tokenApprovalStore;
}
return this.approvalStore;
}
use of org.springframework.security.oauth2.provider.token.TokenStore in project spring-security-oauth by spring-projects.
the class AuthorizationServerEndpointsConfigurer method userApprovalHandler.
private UserApprovalHandler userApprovalHandler() {
if (userApprovalHandler == null) {
if (approvalStore() != null) {
ApprovalStoreUserApprovalHandler handler = new ApprovalStoreUserApprovalHandler();
handler.setApprovalStore(approvalStore());
handler.setRequestFactory(requestFactory());
handler.setClientDetailsService(clientDetailsService);
this.userApprovalHandler = handler;
} else if (tokenStore() != null) {
TokenStoreUserApprovalHandler userApprovalHandler = new TokenStoreUserApprovalHandler();
userApprovalHandler.setTokenStore(tokenStore());
userApprovalHandler.setClientDetailsService(clientDetailsService());
userApprovalHandler.setRequestFactory(requestFactory());
this.userApprovalHandler = userApprovalHandler;
} else {
throw new IllegalStateException("Either a TokenStore or an ApprovalStore must be provided");
}
}
return this.userApprovalHandler;
}
Aggregations