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

Support specifying multiple tenants in @TenantFeature #40358

Open
Eng-Fouad opened this issue Apr 30, 2024 · 5 comments · May be fixed by #40525
Open

Support specifying multiple tenants in @TenantFeature #40358

Eng-Fouad opened this issue Apr 30, 2024 · 5 comments · May be fixed by #40525
Labels
area/oidc kind/enhancement New feature or request

Comments

@Eng-Fouad
Copy link
Contributor

Eng-Fouad commented Apr 30, 2024

Description

Currently, only one tenant can be specified in @TenantFeature. It would be nice to be able to specify multiple tenants instead of only one.

For example, apply custom Jose4j validator on two tenants:

@TenantFeature({"tenant1", "tenant2"})
@ApplicationScoped
public class CustomValidator implements Validator {
    @Override
    public String validate(JwtContext jwtContext) throws MalformedClaimException {
        return null; // TODO
    }
}

Implementation ideas

Change:

String value();

to

String[] value();

and it is backward compatible as @TenantFeature("foo") works with both String value() and String[] value().

@Eng-Fouad Eng-Fouad added the kind/enhancement New feature or request label Apr 30, 2024
@sberyozkin
Copy link
Member

@Eng-Fouad This is a good idea, but I think it only applies to @TenantFeature, which is about applying a feature to tenant(s). @Tenant is now about selecting which tenant must verify the request. Can you update the enhancement title if agreed ?

@Eng-Fouad Eng-Fouad changed the title Support specifying multiple tenants in @TenantFeature/@Tenant Support specifying multiple tenants in @TenantFeature Apr 30, 2024
@Eng-Fouad
Copy link
Contributor Author

@Eng-Fouad This is a good idea, but I think it only applies to @TenantFeature, which is about applying a feature to tenant(s). @Tenant is now about selecting which tenant must verify the request. Can you update the enhancement title if agreed ?

Updated.

@quarkus-bot
Copy link

quarkus-bot bot commented Apr 30, 2024

/cc @pedroigor (bearer-token,oidc)

@sberyozkin
Copy link
Member

@Eng-Fouad Would you like to have a look at the PR ?

@Eng-Fouad
Copy link
Contributor Author

Eng-Fouad commented May 8, 2024

@Eng-Fouad Would you like to have a look at the PR ?

Submitted a PR. I had to use repeating qualifier instead of using array member, as querying CDI beans using a qualifier with an array member will only match CDI beans with exact array. i.e. Arc.container().instance(TokenCustomizer.class, TenantFeature.TenantFeatureLiteral.of("tenant1")) won't match @TenantFeature({"tenant1", "tenant2"}).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/oidc kind/enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants