优化授权认证配置,授权服务器关闭basic认证

This commit is contained in:
zlt
2019-07-27 22:37:32 +08:00
parent ff2b195335
commit 177d8ec060
4 changed files with 7 additions and 18 deletions
@@ -18,7 +18,6 @@ public class PermitProperties {
* 监控中心和swagger需要访问的url * 监控中心和swagger需要访问的url
*/ */
private static final String[] ENDPOINTS = { private static final String[] ENDPOINTS = {
"/oauth/**",
"/actuator/**", "/actuator/**",
"/*/v2/api-docs", "/*/v2/api-docs",
"/swagger/api-docs", "/swagger/api-docs",
@@ -34,17 +34,17 @@ zlt:
ignore: ignore:
# 忽略认证的地址 # 忽略认证的地址
httpUrls: > httpUrls: >
/api-uaa/**, /api-uaa/oauth/**,
/api-uaa/validata/**,
/api-uaa/css/**,
/api-uaa/images/**,
/api-uaa/js/**,
/api-user/users-anon/**, /api-user/users-anon/**,
/login.html, /login.html,
/user/login /user/login
# 配置只认证登录,登录后所有角色都能访问的url # 配置只认证登录,登录后所有角色都能访问的url
menusPaths: /api-user/menus/current menusPaths: /api-user/menus/current
auth: auth:
# 配置必需认证的url
httpUrls: >
/api-uaa/clients/**,
/api-uaa/tokens/**
#是否开启url级别权限 #是否开启url级别权限
urlEnabled: false urlEnabled: false
renew: renew:
@@ -78,9 +78,9 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override @Override
protected void configure(HttpSecurity http) throws Exception { protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests() http.authorizeRequests()
.antMatchers( securityProperties.getIgnore().getUrls()) .anyRequest()
//授权服务器关闭basic认证
.permitAll() .permitAll()
.anyRequest().authenticated()
.and() .and()
.formLogin() .formLogin()
.loginPage(SecurityConstants.LOGIN_PAGE) .loginPage(SecurityConstants.LOGIN_PAGE)
@@ -25,16 +25,6 @@ zlt:
version: 1.0 version: 1.0
base-package: com.central.oauth.controller base-package: com.central.oauth.controller
security: security:
ignore:
# 忽略认证的地址
httpUrls: >
/validata/**,
/clients/**,
/tokens/**,
/login.html,
/css/**,
/images/**,
/js/**
code: code:
# 忽略验证码的应用编号 # 忽略验证码的应用编号
ignoreClientCode: app ignoreClientCode: app