Commit 5151c880 authored by renjie's avatar renjie

oauth认证bug

parent 66be1dde
...@@ -17,12 +17,14 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter ...@@ -17,12 +17,14 @@ public class ResourceServerConfiguration extends ResourceServerConfigurerAdapter
@Override @Override
public void configure(HttpSecurity http) throws Exception { public void configure(HttpSecurity http) throws Exception {
http.exceptionHandling() http
.and()
.logout()
.logoutUrl("/oauth/logout")
.and()
.authorizeRequests() .authorizeRequests()
.antMatchers("/secure/**").authenticated(); .antMatchers("/user/*")
.authenticated()
.antMatchers("/oauth/**").permitAll()
.antMatchers("/shop/*","/ip/*","/group/*").authenticated()
.and()
//关闭跨站请求防护
.csrf().disable();
} }
} }
\ No newline at end of file
...@@ -8,12 +8,14 @@ import org.springframework.security.authentication.AuthenticationManager; ...@@ -8,12 +8,14 @@ import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
/** /**
* @author cdov * @author cdov
*/ */
@EnableWebSecurity
@Configuration @Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter { public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
...@@ -30,8 +32,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { ...@@ -30,8 +32,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
public void configure(WebSecurity web) throws Exception { public void configure(WebSecurity web) throws Exception {
web.ignoring() web.ignoring()
.antMatchers( "/account/authCode", "/user/signup", .antMatchers( "/user/authCode", "/user/signUp",
"/user/reset*", "/token"); "/user/reset*");
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment