spring-projects / spring-projects/spring-security
SEC-2841: AbstractUserDetailsAuthenticationProvider with a UserCache doesn't seem to honor mapped authorities
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 6.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 52
Description
Gregory Gerard (Migrated from SEC-2841) said:
I needed to cache authentications from Active Directory so I created my own CachingActiveDirectoryLdapAuthenticationProvider and delegate to ActiveDirectoryLdapAuthenticationProvider for the meat.
This works just fine.
However, when I added a GrantedAuthoritiesMapper to either CachingActiveDirectoryLdapAuthenticationProvider or ActiveDirectoryLdapAuthenticationProvider or both, while the mapper would get called and the first time use of a URL worked, subsequent operations would fail. When I put a filter in to see what the authorities were, the mapped versions weren't there.
My work around was to explicitly call the mapper in retrieveUser(...). This now works.
In short when caching, the mapper doesn't seem to work with cached authentications.
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
Start with AbstractUserDetailsAuthenticationProvider and the ActiveDirectoryLdapAuthenticationProvider and CachingActiveDirectoryLdapAuthenticationProvider entry points, especially retrieveUser(...), to trace how mapped authorities are handled before and after caching. Done means cached authentications expose the same mapped authorities as the initial authentication, with regression coverage for the cached path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100