| | |
| | | import org.springframework.security.oauth2.provider.approval.TokenStoreUserApprovalHandler; |
| | | import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestFactory; |
| | | import org.springframework.security.oauth2.provider.token.TokenStore; |
| | | import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore; |
| | | import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore; |
| | | |
| | | @Configuration |
| | |
| | | |
| | | @Override |
| | | protected void configure(HttpSecurity http) throws Exception { |
| | | http |
| | | .anonymous().disable() |
| | | .authorizeRequests() |
| | | .antMatchers("/oauth/token").permitAll(); |
| | | http.csrf().disable(); //TODO 暂时关闭CSRF |
| | | http.anonymous().disable() |
| | | .authorizeRequests() |
| | | .antMatchers("/oauth/token").permitAll(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Bean |
| | | public TokenStore tokenStore() { |
| | | //return new InMemoryTokenStore(); |
| | | return new RedisTokenStore(redisConnection); |
| | | return new InMemoryTokenStore(); |
| | | //return new RedisTokenStore(redisConnection); |
| | | } |
| | | |
| | | @Bean |