Comments (1)
Mark St.Godard said:
Ben,
I have committed the initial draft of the Switch User (‘su’) functionality. I created a new filter (SwitchUserProcessingFilter) that handles the ‘switch’ and ‘exit’ url requests.
This filter also uses the authenticationDao to allow access to load users. A few initial assumptions in this version
- will only ‘su’ one level deep
- switch url will need to be secured so that only the desired Administrator can do the ‘su’. We can probably get more fancy here later, possibly doing more mapping of who can do this, and to which target users. Anyway, starting simple.
Example configuration:
/j_acegi_switch_user /j_acegi_exit_user /acegi-security-sample-contacts-filter/secure/debug.jspNote: I have the 2 URLs (j_acegi_switch_user, j_acegi_exit_user) configurable and these are the responsible for their respective requests.
j_acegi_switch_user – will handle a switch attempt and expects the username of the target user
j_acegi_exit_user – will handle the exit attempt and expects that successful switch had taken place.
I used your recommendation of using a custom GrantedAuthority (PREVIOUS_ADMINISTRATOR) to capture the original user. This is interrogated in the exit attempt and used to switch the context back.
I did some local testing with the Contacts sample and did some simple tests of
- logging in (i.e. User 1)
- going to /secure/debug.jsp (view User 1 info)
- going to a jsp that handles the switch (i.e. switchUser.jsp)
- submit request to ‘su’ to another user (i.e. User 2)
- going to /secure/debug.jsp (view User 2 info)
- go to exit page (i.e. exitUser.jsp)
- display current user logged in as, submit button to exit
- going to /secure/debug.jsp (shows User 1 info)
So initial simple tests seem to work, need to polish and do alot more testing.
I have also added applicable unit tests.
Again, feedback welcome.
Cheers,
Mark
from spring-security.
Related Issues (20)
- Add XML support for OIDC backchannel logout
- Add repository for returing Asserting Party Metadata
- Add expiry-aware refreshing asserting party repository
- OAuth2AuthorizationCodeGrantFilter erroneously consumes POST request body with multipart/form-data HOT 2
- Improve documentation about `CredentialsContainer`
- Configure Build to Confirm UnboundId 7 Compatibility
- Introduce `UserAuthorities`
- Support doing a Token Exchange of access token from OIDC login HOT 2
- OIDC Backchannel Logout should allow logout tokens having `typ` header of `logout+jwt`
- Cannot get Stateless Authorisation Server to work HOT 2
- Dynamic register SecurityFilterChain HOT 2
- Spring do not support 401 unauthorized responce by default HOT 1
- Documentation for ServletBearerExchangeFilterFunction incomplete or incorrect
- Consider removing generics from `AuthorizationRequestRepository` HOT 2
- How can classpath public key values be utilized in the OAuth2 client jwks_uri? HOT 6
- Spring Security OAuth2 Client "user-name-attribute" property is being ignored HOT 1
- Method Annotations Should Support @AliasFor
- Using sec:authorize in JSPX causes 'java.lang.NullPointerException: Cannot invoke "jakarta.servlet.ServletRegistration.getClassName()" because "registration" is null'
- Using sec:authorize in JSPX causes 'java.lang.NullPointerException: Cannot invoke "jakarta.servlet.ServletRegistration.getClassName()" because "registration" is null'
- Broken documentation link for 6.4.0-M1
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 spring-security.