-
-
Notifications
You must be signed in to change notification settings - Fork 11k
/
Copy pathClientWebSecurityConfigurer.java
31 lines (27 loc) · 1.18 KB
/
ClientWebSecurityConfigurer.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.xcoding.sso.config;
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
* @author chen.chao
* @version 1.0
* @date 2020/4/16 9:41
* @description
*/
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableOAuth2Sso
public class ClientWebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
// 需要先于需授权地址
http.antMatcher("/**").authorizeRequests().antMatchers("/free").permitAll()
.anyRequest().authenticated();
/* http.antMatcher("/**").authorizeRequests()
.anyRequest().authenticated().antMatchers("/free").permitAll();*/
}
}