Comments (9)
@liyiorg thank you for reporting i will check that asap but I'm currently on vacation. So I'm not sure to do something before January. Sorry
from cas-security-spring-boot-starter.
@liyiorg I fixed something on develop branch. I will push asap 0.6.1-SNAPSHOT
on maven central (I will say you when it will be available) in order to test the fix if you're ok.
PS: I updated the sample to add method based security using annotation but I also tested using your code/way (but not commited).
from cas-security-spring-boot-starter.
@kakawait I change project dependency to 0.6.1-SNAPSHOT,Test in two ways.
user list
- usera has roles A
- userb has roles B
Cas client service config
server:
port: 9090
security:
cas:
server:
base-url: https://localhost:8443/cas
service:
resolution-mode: dynamic
user:
roles-attributes:
- roles
test 1
use @secured annotation,it's work ok.
The user "usera" only access path /testa .
The user "userb" only access path /testb.
@Controller
public class TestController {
@Secured("ROLE_A")
@RequestMapping("/testa")
public String testa(HttpServletRequest request){
System.out.println("hasRoleA:" + request.isUserInRole("A"));
return "test_cas";
}
@Secured("ROLE_B")
@RequestMapping("/testb")
public String testb(HttpServletRequest request){
System.out.println("hasRoleB:" + request.isUserInRole("B"));
return "test_cas";
}
}
test 2
Override method configure(HttpSecurity http) and remove @secured annotation.
The usera access path http://localhost:9090/testa
print hasRoleA:true
The usera access path http://localhost:9090/testb
print hasRoleB:false
The user usera can access any path!
@Configuration
class CustomCasSecurityConfiguration extends CasSecurityConfigurerAdapter {
@Override
public void configure(CasAuthenticationFilterConfigurer filter) {
// Here you can configure CasAuthenticationFilter
}
@Override
public void configure(CasSingleSignOutFilterConfigurer filter) {
// Here you can configure SingleSignOutFilter
}
@Override
public void configure(CasAuthenticationProviderSecurityBuilder provider) {
// Here you can configure CasAuthenticationProvider
}
@Override
public void configure(HttpSecurity http) throws Exception {
// Here you can configure Spring Security HttpSecurity object during
// init configure
http
.authorizeRequests()
.antMatchers("/testa").hasRole("A")
.antMatchers("/testb").hasRole("B");
}
@Override
public void configure(CasTicketValidatorBuilder ticketValidator) {
// Here you can configure CasTicketValidator
}
}
@Controller
public class TestController {
//@Secured("ROLE_A")
@RequestMapping("/testa")
public String testa(HttpServletRequest request){
System.out.println("hasRoleA:" + request.isUserInRole("A"));
return "test_cas";
}
//@Secured("ROLE_B")
@RequestMapping("/testb")
public String testb(HttpServletRequest request){
System.out.println("hasRoleB:" + request.isUserInRole("B"));
return "test_cas";
}
}
from cas-security-spring-boot-starter.
@liyiorg you said
I change project dependency to 0.6.1-SNAPSHOT
And it works without any other operations? Because you have to add snapshot repository or mvn clean install
project in develop branch.
I asking, I'm not able to reproduce. (Just I don't use security.cas.user.roles-attribute.roles
I will try with that asap)
from cas-security-spring-boot-starter.
@liyiorg could you please tell me how do you upgrade to 0.6.1-SNAPSHOT
? It may missing something
from cas-security-spring-boot-starter.
@kakawait , I run the right way in your way ,0.6.1-SNAPSHOT run ok.
thank you very much for your support and the unselfish contribution of open source!
from cas-security-spring-boot-starter.
@liyiorg Nice I will release version really soon
I'm happy when everyone are happy :)
from cas-security-spring-boot-starter.
@kakawait When will it be released 0.6.1-release
from cas-security-spring-boot-starter.
Sorry I get busy i will release it today
from cas-security-spring-boot-starter.
Related Issues (20)
- Securing CORS RestAPI HOT 1
- Where is 1.0.0-beta-1 built from? HOT 6
- Cannot get targetUrl HOT 5
- Does it support set `ignorePattern` HOT 4
- Integration tests
- Invalid custom permission validation HOT 5
- Support for Saml11TicketValidator HOT 1
- Endpoint which authenticate from CAS Server HOT 1
- Whether it is suitable for front-end projects HOT 4
- Configuration question HOT 1
- Proxy Ticket Validator Configuration Property HOT 1
- Replace PostConstruct
- Fix JDK11 build
- Compilation error java-cas-client 3.6.1 HOT 1
- [Question] How to extract attributes from XML document return by ticket validation? HOT 1
- CAS logout custom configuration logout success url ? HOT 1
- CAS Proxy Authentication HOT 6
- Problem with Logout HOT 3
- Use springboot 2.7.0+ with SecurityFilterChain instead of deprecated WebSecurityConfigurerAdapter HOT 1
- When will it be possible to use this library with spring boot 3?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cas-security-spring-boot-starter.