spring-projects / spring-projects/spring-security
SEC-2711: Improve access to property springSecurityContextKey in HttpSessionSecurityContextRepository
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Odilo Oehmichen (Migrated from SEC-2711) said:
Due to issue SEC-1695 the HttpSessionSecurityContextRepository got the property springSecurityContextKey which makes it possible to set the key under which the spring security context should be stored in the session at deployment time. - That's a good feature ;-)
In my current project we need to handle different security contexts in one Http-Session. Since the number of contexts (and their names) is not fully defined at deployment time, we can not use the solution provided in SEC-1695 (i.e. having an own SecurityContextRepository for each security context): We have to create the key at runtime. (Note: The project is part of a WCM environment).
For the HttpSessionSecurityContextRepository I see two possible improvement-levels:
Always access the property springSecurityContextKey using the public getter => make it possible to overwrite the behaviour of returning a contextKey in a subclass.
Introduce a new component SecurityContextKeyProvider which is responsible for generating the key - the default implementation just returns a static (but configurable) key.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Begin with HttpSessionSecurityContextRepository and the SEC-1695 context-key behavior described in the issue. Resolve whether getter overriding or a SecurityContextKeyProvider is intended, then define tests showing that distinct security contexts can use runtime-generated keys within one session.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100