jakartaee / jakartaee/security
Decorators and alternatives not working on IdentityStores
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 66
- Forks
- 43
- PR merge metrics
- No merged PRs in 30d
Description
I've created the following decorator to do some operations with the returned groups:
@Priority(2000)
@Decorator
public class IdentityStoreDecorator implements IdentityStore {
@Inject
@Delegate
@Any
private IdentityStore decorated;
@Override
public CredentialValidationResult validate(Credential credential) {
return decorated.validate(credential);
}
@Override
public Set<String> getCallerGroups(CredentialValidationResult validationResult) {
return decorated.getCallerGroups(validationResult);
}
}
But the CdiUtils#getBeanDefinitions() method which is internally called to get the enabled IdentityStores returns the original object (org.glassfish.soteria.cdi.CdiProducer interface javax.security.enterprise.identitystore.DatabaseIdentityStoreDefinition).
I guess the problem is on the org.glassfish.soteria.cdi.CdiProducer which is creating instances without taking decorators into account. The same applies to @Alternative's.
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 CdiUtils#getBeanDefinitions() and the org.glassfish.soteria.cdi.CdiProducer implementation that creates enabled IdentityStores. Reproduce the reported decorator and @Alternative cases and trace why the returned bean is the original DatabaseIdentityStoreDefinition object. Done means enabled IdentityStores respect CDI decorators and alternatives.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100