Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort identity providers by priority in QuarkusIdentityProviderManagerImpl #42126

Closed
danilopiazza opened this issue Jul 25, 2024 · 3 comments · Fixed by #42179
Closed

Sort identity providers by priority in QuarkusIdentityProviderManagerImpl #42126

danilopiazza opened this issue Jul 25, 2024 · 3 comments · Fixed by #42179
Labels
area/security kind/bug Something isn't working
Milestone

Comments

@danilopiazza
Copy link
Contributor

Description

IdentityProvider from quarkus-security has a priority method which, apparently, is not used anywhere.

Should QuarkusIdentityProviderManagerImpl sort each value of providers by priority, like it does for augmentors?

Implementation ideas

The implementation could look like this code from QuarkusIdentityProviderManagerImpl.Builder.build():

@Override
providers.values().forEach(providers -> providers.sort(new Comparator<IdentityProvider>() {
    @Override
    public int compare(IdentityProvider o1, IdentityProvider o2) {
        return Integer.compare(o2.priority(), o1.priority());
    }
}));
@sberyozkin
Copy link
Member

Thanks @danilopiazza for marking it as an enhancement, it looks like a bug. What is happening in your case, do you see built in providers getting in front unexpectedly ? AFAIK, if you use CDI @Alternative, possibly with @Priority(1), you should get your custom IdentityProvider chosen only.

@sberyozkin
Copy link
Member

But that would be a workaround. if it has a priority method then it should be effective

@sberyozkin sberyozkin added kind/bug Something isn't working and removed kind/enhancement New feature or request labels Jul 25, 2024
@danilopiazza
Copy link
Contributor Author

Thanks @danilopiazza for marking it as an enhancement, it looks like a bug. What is happening in your case, do you see built in providers getting in front unexpectedly ? AFAIK, if you use CDI @Alternative, possibly with @Priority(1), you should get your custom IdentityProvider chosen only.

Yes, I see this exact behavior and I can confirm that the workaround is working. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/security kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants