org.springframework.security.oauth2.provider.token.store.JdbcTokenStore Java Examples
The following examples show how to use
org.springframework.security.oauth2.provider.token.store.JdbcTokenStore.
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: TokenServiceImpl.java From auth-server with Apache License 2.0 | 6 votes |
@Override public void revokeTokens(String username) { log.debug("Revoking tokens for {}", username); if (!(tokenStore instanceof JdbcTokenStore)) { log.debug("Token store is not instance of JdbcTokenStore. Cannot revoke tokens!"); return; } Collection<OAuth2AccessToken> tokens = ((JdbcTokenStore) tokenStore).findTokensByUserName(username); for (OAuth2AccessToken token : tokens) { log.debug("Revoking access token {}", token); tokenStore.removeAccessToken(token); log.debug("Revoking refresh token {}", token.getRefreshToken()); tokenStore.removeRefreshToken(token.getRefreshToken()); } }
Example #2
Source File: TokenStoreConfig.java From open-capacity-platform with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnProperty(prefix="security.oauth2.token.store",name="type" ,havingValue="jdbc" ,matchIfMissing=false) public JdbcTokenStore jdbcTokenStore(){ // oauth_access_token oauth_refresh_token 创建两张表 // return new JdbcTokenStore( dataSource ) ; return new JdbcTokenStore( dataSource ) ; }
Example #3
Source File: TokenController.java From spring-security-oauth with MIT License | 5 votes |
@RequestMapping(method = RequestMethod.POST, value = "/tokens/revokeRefreshToken/{tokenId:.*}") @ResponseBody public String revokeRefreshToken(@PathVariable String tokenId) { if (tokenStore instanceof JdbcTokenStore) { ((JdbcTokenStore) tokenStore).removeRefreshToken(tokenId); } return tokenId; }
Example #4
Source File: TokenController.java From oauth2lab with MIT License | 5 votes |
@RequestMapping(method = RequestMethod.POST, value = "/tokens/revokeRefreshToken/{tokenId:.*}") @ResponseBody public String revokeRefreshToken(@PathVariable String tokenId) { if (tokenStore instanceof JdbcTokenStore) { ((JdbcTokenStore) tokenStore).removeRefreshToken(tokenId); } return tokenId; }
Example #5
Source File: LdapAuthServiceImpl.java From pacbot with Apache License 2.0 | 5 votes |
@Override public void logout(Principal principal) { JdbcTokenStore jdbcTokenStore = tokenStore(); OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) principal; OAuth2AccessToken accessToken = jdbcTokenStore.getAccessToken(oAuth2Authentication); jdbcTokenStore.removeAccessToken(accessToken.getValue()); jdbcTokenStore.removeRefreshToken(accessToken.getRefreshToken()); }
Example #6
Source File: ApiService.java From pacbot with Apache License 2.0 | 5 votes |
public void logout(Principal principal) { JdbcTokenStore jdbcTokenStore = tokenStore(); OAuth2Authentication oAuth2Authentication = (OAuth2Authentication) principal; OAuth2AccessToken accessToken = jdbcTokenStore.getAccessToken(oAuth2Authentication); jdbcTokenStore.removeAccessToken(accessToken.getValue()); jdbcTokenStore.removeRefreshToken(accessToken.getRefreshToken()); }
Example #7
Source File: SecurityConfig.java From dhis2-core with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Primary @Bean public AuthorizationServerTokenServices tokenServices() { DefaultTokenServices defaultTokenServices = new DefaultTokenServices(); defaultTokenServices.setTokenStore( new JdbcTokenStore( dataSource ) ); defaultTokenServices.setSupportRefreshToken( true ); return defaultTokenServices; }
Example #8
Source File: RefreshTokenRevocationService.java From OAuth-2.0-Cookbook with MIT License | 5 votes |
@Override public void revoke(String token) { if (tokenStore instanceof JdbcTokenStore) { JdbcTokenStore store = (JdbcTokenStore) tokenStore; store.removeRefreshToken(token); } }
Example #9
Source File: TokenStoreConfig.java From open-capacity-platform with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnProperty(prefix="security.oauth2.token.store",name="type" ,havingValue="jdbc" ,matchIfMissing=false) public JdbcTokenStore jdbcTokenStore(){ // oauth_access_token oauth_refresh_token 创建两张表 // return new JdbcTokenStore( dataSource ) ; return new JdbcTokenStore( dataSource ) ; }
Example #10
Source File: SecurityConfiguration.java From multiapps-controller with Apache License 2.0 | 4 votes |
@Inject @Bean public JdbcTokenStore tokenStore(DataSource dataSource) { return TokenStoreFactory.getTokenStore(dataSource); }
Example #11
Source File: WebSecurityConfiguration.java From DAFramework with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { JdbcTokenStore jdbcTokenStore = new JdbcTokenStore(dataSource); return jdbcTokenStore; }
Example #12
Source File: JdbcOAuth2Config.java From microservice-skeleton with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(this.dataSource); }
Example #13
Source File: TokenStoreFactory.java From multiapps-controller with Apache License 2.0 | 4 votes |
public static JdbcTokenStore getTokenStore(DataSource dbDataSource) { LOGGER.info(MessageFormat.format(Messages.OAUTH_TOKEN_STORE, "JdbcTokenStore")); return new JdbcTokenStore(dbDataSource); }
Example #14
Source File: AuthServerOAuth2Config.java From Building-Web-Apps-with-Spring-5-and-Angular with MIT License | 4 votes |
@Bean(name="tokenStore") public TokenStore tokenStore() { return new JdbcTokenStore(this.dataSource); }
Example #15
Source File: OAuth2Config.java From microservice-integration with MIT License | 4 votes |
@Bean public JdbcTokenStore tokenStore(DataSource dataSource) { return new JdbcTokenStore(dataSource); }
Example #16
Source File: OauthConfig.java From lolibox with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore(DataSource ds){ return new JdbcTokenStore(ds); }
Example #17
Source File: OAuth2ResourceServerConfig.java From spring-boot with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource()); }
Example #18
Source File: OAuth2AuthorizationServerConfig.java From spring-boot with Apache License 2.0 | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource()); }
Example #19
Source File: AuthServerOAuth2Config.java From Building-Web-Apps-with-Spring-5-and-Angular with MIT License | 4 votes |
@Bean(name="tokenStore") public TokenStore tokenStore() { return new JdbcTokenStore(this.dataSource); }
Example #20
Source File: OAuth2ResourceServerConfig.java From spring-security-oauth with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource()); }
Example #21
Source File: OAuth2AuthorizationServerConfigInMemory.java From spring-security-oauth with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource()); }
Example #22
Source File: OAuth2AuthorizationServerConfig.java From spring-security-oauth with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource()); }
Example #23
Source File: Oauth2AuthorizationServerApplication.java From spring-oauth2-jwt-jdbc with MIT License | 4 votes |
/** * Stores the client oauth authorization codes and client access tokens in a jdbc datastore. This store is managed by oauth2. * @return */ @Bean public JdbcTokenStore tokenStore() { return new JdbcTokenStore(dataSource); }
Example #24
Source File: OAuth2ServerConfiguration.java From todo-spring-angular with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource); }
Example #25
Source File: OAuth2ServerConfiguration.java From angularjs-springboot-bookstore with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(dataSource); }
Example #26
Source File: Oauth2TokenStoreConfiguration.java From onetwo with Apache License 2.0 | 4 votes |
@Bean public TokenStore jdbcTokenStore(@Autowired DataSource dataSource){ JdbcTokenStore store = new JdbcTokenStore(dataSource); return store; }
Example #27
Source File: CustomTokenStore.java From spring-microservice-boilerplate with MIT License | 4 votes |
private JdbcTokenStore jdbcTokenStore() { return new JdbcTokenStore(dataSource); }
Example #28
Source File: OAuth2ServerConfiguration.java From spring-oauth-server with GNU General Public License v2.0 | 4 votes |
@Bean public TokenStore tokenStore(DataSource dataSource) { return new JdbcTokenStore(dataSource); }
Example #29
Source File: OAuthConfiguration.java From spring-oauth-example with MIT License | 4 votes |
@Override public void configure(ResourceServerSecurityConfigurer resources) throws Exception { TokenStore tokenStore = new JdbcTokenStore(oauthDataSource()); resources.resourceId("todo-services") .tokenStore(tokenStore); }
Example #30
Source File: OAuthConfiguration.java From spring-oauth-example with MIT License | 4 votes |
@Bean public TokenStore tokenStore() { return new JdbcTokenStore(oauthDataSource()); }