org.springframework.security.oauth2.provider.token.TokenStore Java Examples
The following examples show how to use
org.springframework.security.oauth2.provider.token.TokenStore.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OAuth2AuthorizationServerConfig.java From oauth-boot with MIT License | 6 votes |
@Autowired(required = false) public OAuth2AuthorizationServerConfig(AuthenticationManager authenticationManager, BootClientDetailsService clientDetailsService, TokenStore tokenStore, JwtAccessTokenConverter converter, AuthenticationEntryPoint authenticationEntryPoint, BootOAuth2WebResponseExceptionTranslator bootWebResponseExceptionTranslator, PasswordEncoder passwordEncoder, BootUserDetailService userDetailsService) { this.authenticationManager = authenticationManager; this.clientDetailsService = clientDetailsService; this.tokenStore = tokenStore; this.converter = converter; this.authenticationEntryPoint = authenticationEntryPoint; this.bootWebResponseExceptionTranslator = bootWebResponseExceptionTranslator; this.passwordEncoder = passwordEncoder; this.userDetailsService = userDetailsService; }
Example #2
Source File: OpenHelper.java From open-cloud with MIT License | 6 votes |
/** * 更新OpenUser * * @param openUser */ public static void updateOpenUser(TokenStore tokenStore, OpenUserDetails openUser) { if (openUser == null) { return; } Assert.notNull(openUser.getClientId(), "客户端ID不能为空"); Assert.notNull(openUser.getUsername(), "用户名不能为空"); // 动态更新客户端生成的token Collection<OAuth2AccessToken> accessTokens = tokenStore.findTokensByClientIdAndUserName(openUser.getClientId(), openUser.getUsername()); if (accessTokens != null && !accessTokens.isEmpty()) { for (OAuth2AccessToken accessToken : accessTokens) { // 由于没有set方法,使用反射机制强制赋值 OAuth2Authentication oAuth2Authentication = tokenStore.readAuthentication(accessToken); if (oAuth2Authentication != null) { Authentication authentication = oAuth2Authentication.getUserAuthentication(); ReflectionUtils.setFieldValue(authentication, "principal", openUser); // 重新保存 tokenStore.storeAccessToken(accessToken, oAuth2Authentication); } } } }
Example #3
Source File: AuthorizationServerConfiguration.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 5 votes |
@Bean public TokenStore tokenStore() { if (this.jwtEnabled) { return new JwtTokenStore(accessTokenConverter()); } else { return new InMemoryTokenStore(); } }
Example #4
Source File: IssuerCheckConfiguration.java From spring-cloud-sso-connector with Apache License 2.0 | 5 votes |
@Bean public TokenStore jwkTokenStore() throws MalformedURLException { ProviderDiscoveryClient discoveryClient = new ProviderDiscoveryClient(ssoServiceUrl); ProviderConfiguration providerConfiguration = discoveryClient.discover(); IssuerClaimVerifier issuerClaimVerifier = new IssuerClaimVerifier(providerConfiguration.getIssuer()); return new JwkTokenStore( keySetUri, issuerClaimVerifier ); }
Example #5
Source File: OAuth2SecurityConfiguration.java From swagger-aem with Apache License 2.0 | 5 votes |
@Bean @Autowired public TokenStoreUserApprovalHandler userApprovalHandler(TokenStore tokenStore){ TokenStoreUserApprovalHandler handler = new TokenStoreUserApprovalHandler(); handler.setTokenStore(tokenStore); handler.setRequestFactory(new DefaultOAuth2RequestFactory(clientDetailsService)); handler.setClientDetailsService(clientDetailsService); return handler; }
Example #6
Source File: ResourceServerTokenServicesConfiguration.java From spring-security-oauth2-boot with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(ResourceServerTokenServices.class) public DefaultTokenServices jwtTokenServices(TokenStore jwtTokenStore) { DefaultTokenServices services = new DefaultTokenServices(); services.setTokenStore(jwtTokenStore); return services; }
Example #7
Source File: OAuth2AuthorizationServerConfiguration.java From spring-security-oauth2-boot with Apache License 2.0 | 5 votes |
public AuthorizationSecurityConfigurer(BaseClientDetails details, AuthenticationConfiguration authenticationConfiguration, ObjectProvider<TokenStore> tokenStore, ObjectProvider<AccessTokenConverter> tokenConverter, AuthorizationServerProperties properties) throws Exception { this.details = details; this.authenticationManager = authenticationConfiguration.getAuthenticationManager(); this.tokenStore = tokenStore.getIfAvailable(); this.tokenConverter = tokenConverter.getIfAvailable(); this.properties = properties; }
Example #8
Source File: AuthorizationServerConfiguration.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 5 votes |
@Bean public TokenStore tokenStore() { if (this.jwtEnabled) { return new JwtTokenStore(accessTokenConverter()); } else { return new InMemoryTokenStore(); } }
Example #9
Source File: AuthorizationServerConfiguration.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 5 votes |
@Bean public TokenStore tokenStore() { if (this.jwtEnabled) { return new JwtTokenStore(accessTokenConverter()); } else { return new InMemoryTokenStore(); } }
Example #10
Source File: TokenService.java From osiam with MIT License | 5 votes |
@Autowired public TokenService(TokenStore tokenStore, SCIMUserProvisioning userProvisioning, ClientRepository clientRepository) { this.tokenStore = tokenStore; this.userProvisioning = userProvisioning; this.clientRepository = clientRepository; }
Example #11
Source File: OAuth2AuthServer.java From Learning-Path-Spring-5-End-to-End-Programming with MIT License | 5 votes |
@Autowired public OAuth2AuthServer(AuthenticationManager authenticationManager, TokenStore tokenStore, JwtAccessTokenConverter jwtAccessTokenConverter) { this.authenticationManager = authenticationManager; this.tokenStore = tokenStore; this.jwtAccessTokenConverter = jwtAccessTokenConverter; }
Example #12
Source File: JweTokenStore.java From OAuth-2.0-Cookbook with MIT License | 5 votes |
public JweTokenStore(String encodedSigningKey, TokenStore delegate, JwtAccessTokenConverter converter, JweTokenSerializer crypto) { this.encodedSigningKey = encodedSigningKey; this.delegate = delegate; this.converter = converter; this.crypto = crypto; }
Example #13
Source File: SecurityBeanOverrideConfiguration.java From cubeai with Apache License 2.0 | 4 votes |
@Bean @Primary public TokenStore tokenStore() { return null; }
Example #14
Source File: JwkAuthorizationServerConfiguration.java From spring-security-oauth with MIT License | 4 votes |
@Bean public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) { return new JwtTokenStore(jwtAccessTokenConverter); }
Example #15
Source File: OAuth2ResourceServerConfig.java From spring-security-oauth with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource()); }
Example #16
Source File: _OAuth2ServerConfiguration.java From jhipster-ribbon-hystrix with GNU General Public License v3.0 | 4 votes |
@Bean public TokenStore tokenStore() { return new <% if (databaseType == 'sql') { %>JdbcTokenStore(dataSource);<% } else { %>MongoDBTokenStore(oAuth2AccessTokenRepository, oAuth2RefreshTokenRepository);<% } %> }
Example #17
Source File: MicroserviceSecurityConfiguration.java From cubeai with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) { return new JwtTokenStore(jwtAccessTokenConverter); }
Example #18
Source File: RefreshTokenFilter.java From cubeai with Apache License 2.0 | 4 votes |
public RefreshTokenFilter(OAuth2AuthenticationService authenticationService, TokenStore tokenStore) { this.authenticationService = authenticationService; this.tokenStore = tokenStore; }
Example #19
Source File: SecurityBeanOverrideConfiguration.java From tutorials with MIT License | 4 votes |
@Bean @Primary public TokenStore tokenStore() { return null; }
Example #20
Source File: AuthorizacionServerConfiguration.java From Hands-On-RESTful-API-Design-Patterns-and-Best-Practices with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new InMemoryTokenStore(); }
Example #21
Source File: MicroserviceSecurityConfiguration.java From cubeai with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore(JwtAccessTokenConverter jwtAccessTokenConverter) { return new JwtTokenStore(jwtAccessTokenConverter); }
Example #22
Source File: AuthorizationServerTokenServicesConfiguration.java From spring-security-oauth2-boot with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean(TokenStore.class) public TokenStore jwtTokenStore(JwtAccessTokenConverter jwtTokenEnhancer) { return new JwtTokenStore(jwtTokenEnhancer); }
Example #23
Source File: AuthorizationServerConfiguration.java From spring-boot-samples with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore() { // 基于 JDBC 实现,令牌保存到数据 return new JdbcTokenStore(dataSource()); }
Example #24
Source File: ResourceServerConfig.java From codeway_service with GNU General Public License v3.0 | 4 votes |
@Bean public TokenStore tokenStore() { return new JwtTokenStore(jwtAccessTokenConverter()); }
Example #25
Source File: TokenStoreConfig.java From fw-spring-cloud with Apache License 2.0 | 4 votes |
/** * 使用jwtTokenStore存储token * @return */ @Bean public TokenStore jwtTokenStore(){ return new JwtTokenStore(jwtAccessTokenConverter()); }
Example #26
Source File: AuthorizationServerConfiguration.java From Hands-On-Microservices-with-Spring-Boot-and-Spring-Cloud with MIT License | 4 votes |
public IntrospectEndpoint(TokenStore tokenStore) { this.tokenStore = tokenStore; }
Example #27
Source File: OAuth2Config.java From spring-auth-example with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JwtTokenStore(jwtTokenEnhancer()); }
Example #28
Source File: OAuth2ResourceServer.java From OAuth-2.0-Cookbook with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new RedisTokenStore(connectionFactory); }
Example #29
Source File: OAuth2ServerConfiguration.java From todo-spring-angular with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource); }
Example #30
Source File: SecurityBeanOverrideConfiguration.java From cubeai with Apache License 2.0 | 4 votes |
@Bean @Primary public TokenStore tokenStore() { return null; }