cas-security-spring-boot-starter
cas-security-spring-boot-starter copied to clipboard
Invalid custom permission validation
Hello, I have a service with name 'system1' , I want limit user mast has permission "SERVICE_SYSTEM_1" , The following code is not valid in version 1.0.0 , But invalid in version 0.8.1。
public class ServiceCasSecurityConfigurerAdapter extends CasSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest().hasAuthority("SERVICE_SYSTEM_1");
}
}
Quote CasLoginSecurityConfiguration version 1.0.0
@Override
protected void configure(HttpSecurity http) throws Exception {
String[] paths = getSecurePaths();
if (paths.length > 0) {
http.requestMatchers().antMatchers(paths);
CasHttpSecurityConfigurer.cas().configure(http);
CasSecurityProperties.SecurityAuthorizeMode mode = casSecurityProperties.getAuthorization().getMode();
if (mode == CasSecurityProperties.SecurityAuthorizeMode.ROLE) {
String[] roles = casSecurityProperties.getAuthorization().getRoles();
http.authorizeRequests().anyRequest().hasAnyRole(roles);
} else if (mode == CasSecurityProperties.SecurityAuthorizeMode.AUTHENTICATED) {
http.authorizeRequests().anyRequest().authenticated();
} else if (mode == CasSecurityProperties.SecurityAuthorizeMode.NONE) {
http.authorizeRequests().anyRequest().permitAll();
} else if(mode == CasSecurityProperties.SecurityAuthorizeMode.NOT_DO){
// ======================
//TODO Can you add a enum, not do any thing. thanks!
// ======================
}
}
}
@liyiorg
The following code is not valid in version 1.0.0 , But invalid in version 0.8.1。
Do you mean valid in version 0.8.1 ?
And what do you mean by valid / invalid ?
@kakawait Sorry, I am try again, The both version invalid . We have five system integrate CAS , But not all systems can be accessed by users .
I find the default SecurityAuthorizeMode not same in both version.
@liyiorg do you have small project to test, or if not possible could you please share with me your security.cas.*
configuration?
@kakawait thanks
security:
cas:
server:
base-url: https://xxx.sso.com/cas
service:
base-url: http://service1/index
@kakawait I am add a enum for SecurityAuthorizeMode solve this problem, It's name CUSTOM .