Skip to content

Commit ffc23a3

Browse files
Merge pull request #16 from LookBackInTheRain/dev
Dev
2 parents 07606e6 + 220f9d1 commit ffc23a3

File tree

3 files changed

+9
-43
lines changed

3 files changed

+9
-43
lines changed

src/main/java/club/yuit/oauth/boot/config/SecurityConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ public void configure(AuthenticationManagerBuilder auth) throws Exception {
6565
protected void configure(HttpSecurity http) throws Exception {
6666

6767
http
68-
// 必须配置,不然OAuth2的http配置不生效----不明觉厉
68+
// http security 要拦截的url,这里这拦截,oauth2相关和登录登录相关的url,其他的交给资源服务处理
6969
.requestMatchers()
70-
.antMatchers("/auth/login", properties.getLoginProcessUrl(), "/oauth/authorize")
70+
.antMatchers( "/oauth/**",properties.getLoginPage(),properties.getLoginProcessUrl())
7171
.and()
7272
.authorizeRequests()
7373
// 自定义页面或处理url是,如果不配置全局允许,浏览器会提示服务器将页面转发多次
@@ -80,7 +80,7 @@ protected void configure(HttpSecurity http) throws Exception {
8080
http.formLogin()
8181
.failureHandler(handler)
8282
// 页面
83-
.loginPage("/auth/login")
83+
.loginPage(properties.getLoginPage())
8484
// 登录处理url
8585
.loginProcessingUrl(properties.getLoginProcessUrl());
8686

src/main/java/club/yuit/oauth/boot/config/auth2/OAuth2AuthorizationServerConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public void configure(AuthorizationServerSecurityConfigurer security) throws Exc
8686
// 自定义异常处理端口
8787
security.authenticationEntryPoint(authenticationEntryPoint);
8888

89-
// 认证之前的过滤器
89+
// 客户端认证之前的过滤器
9090
security.addTokenEndpointAuthenticationFilter(filter);
9191

9292
security.tokenKeyAccess("permitAll()").checkTokenAccess("isAuthenticated()");

src/main/java/club/yuit/oauth/boot/support/BootSecurityProperties.java

Lines changed: 5 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import club.yuit.oauth.boot.support.common.TokenStoreType;
44
import club.yuit.oauth.boot.support.properities.BootLogLevelProperties;
55
import club.yuit.oauth.boot.support.properities.BootSmsCodeProperties;
6+
import lombok.Getter;
7+
import lombok.Setter;
68
import org.springframework.boot.context.properties.ConfigurationProperties;
79
import org.springframework.boot.context.properties.EnableConfigurationProperties;
810
import org.springframework.boot.context.properties.NestedConfigurationProperty;
@@ -17,6 +19,8 @@
1719
@Configuration
1820
@EnableConfigurationProperties
1921
@ConfigurationProperties(prefix = "boot.oauth")
22+
@Getter
23+
@Setter
2024
public class BootSecurityProperties {
2125

2226

@@ -27,6 +31,7 @@ public class BootSecurityProperties {
2731
private TokenStoreType tokenStoreType = TokenStoreType.memory;
2832

2933
private String loginProcessUrl="/auth/authorize";
34+
private String loginPage="/auth/login";
3035

3136

3237
/**
@@ -43,46 +48,7 @@ public class BootSecurityProperties {
4348

4449

4550

46-
/*****--------------getter setter----------------------******/
47-
public TokenStoreType getTokenStoreType() {
48-
return tokenStoreType;
49-
}
5051

51-
public void setTokenStoreType(TokenStoreType tokenStoreType) {
52-
this.tokenStoreType = tokenStoreType;
53-
}
54-
55-
public String getLoginProcessUrl() {
56-
return loginProcessUrl;
57-
}
58-
59-
public void setLoginProcessUrl(String loginProcessUrl) {
60-
this.loginProcessUrl = loginProcessUrl;
61-
}
62-
63-
public BootLogLevelProperties getLogging() {
64-
return logging;
65-
}
66-
67-
public void setLogging(BootLogLevelProperties logging) {
68-
this.logging = logging;
69-
}
70-
71-
public BootSmsCodeProperties getSms() {
72-
return sms;
73-
}
74-
75-
public void setSms(BootSmsCodeProperties sms) {
76-
this.sms = sms;
77-
}
78-
79-
public String getTokenSigningKey() {
80-
return tokenSigningKey;
81-
}
82-
83-
public void setTokenSigningKey(String tokenSigningKey) {
84-
this.tokenSigningKey = tokenSigningKey;
85-
}
8652

8753

8854
}

0 commit comments

Comments
 (0)