修改了接口权限认证方式
This commit is contained in:
parent
c125c250ae
commit
8cad64f69e
@ -4,8 +4,6 @@ package ink.wgink.login.oauth2.client.config;
|
|||||||
import ink.wgink.login.oauth2.client.converter.OAuth2ClientUserAccessTokenConverter;
|
import ink.wgink.login.oauth2.client.converter.OAuth2ClientUserAccessTokenConverter;
|
||||||
import ink.wgink.properties.BaseProperties;
|
import ink.wgink.properties.BaseProperties;
|
||||||
import ink.wgink.properties.oauth2.client.OAuth2ClientProperties;
|
import ink.wgink.properties.oauth2.client.OAuth2ClientProperties;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
|
import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -46,25 +44,16 @@ public class OAuth2ClientConfig extends WebSecurityConfigurerAdapter {
|
|||||||
"/wechat-miniapp/**",
|
"/wechat-miniapp/**",
|
||||||
"/route/file/**",
|
"/route/file/**",
|
||||||
};
|
};
|
||||||
String assetsMatchers = baseProperties.getAssetsMatchers();
|
http.formLogin()
|
||||||
String[] fullAntMatchers;
|
|
||||||
if (!StringUtils.isBlank(assetsMatchers)) {
|
|
||||||
String[] assetsMatchersArray = baseProperties.getAssetsMatchers().split(",");
|
|
||||||
fullAntMatchers = ArrayUtils.addAll(defaultAntMatchers, assetsMatchersArray);
|
|
||||||
} else {
|
|
||||||
fullAntMatchers = defaultAntMatchers;
|
|
||||||
}
|
|
||||||
http
|
|
||||||
.formLogin()
|
|
||||||
.defaultSuccessUrl("/authorize", true)
|
.defaultSuccessUrl("/authorize", true)
|
||||||
.and()
|
.and()
|
||||||
.logout().logoutSuccessUrl(oAuth2ClientProperties.getOauthLogout())
|
.logout().logoutSuccessUrl(oAuth2ClientProperties.getOauthLogout())
|
||||||
.and()
|
.and()
|
||||||
.authorizeRequests().antMatchers(fullAntMatchers).permitAll()
|
.authorizeRequests().antMatchers(defaultAntMatchers).permitAll()
|
||||||
.and()
|
.and()
|
||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
.access("@rbacService.hasPermission(request, authentication)")
|
.access("@accessWhiteList.hasPermission(request, authentication)")
|
||||||
.and()
|
.and()
|
||||||
.headers().frameOptions().sameOrigin()
|
.headers().frameOptions().sameOrigin()
|
||||||
.and()
|
.and()
|
||||||
|
Loading…
Reference in New Issue
Block a user