-
Notifications
You must be signed in to change notification settings - Fork 2
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
Multiple implementations of Subdomain tenant resolver supporting every domain suffix #234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think SubdomainTenantResolver
will resolve hostnames properly as it is now 🤔
.../src/main/java/io/micronaut/multitenancy/tenantresolver/AbstractSubdomainTenantResolver.java
Outdated
Show resolved
Hide resolved
...n/java/io/micronaut/multitenancy/tenantresolver/PublicSuffixListSubdomainTenantResolver.java
Outdated
Show resolved
Hide resolved
return TenantResolver.DEFAULT; | ||
protected Serializable resolveSubdomain(@NonNull String host) { | ||
if (host.chars().filter(ch -> ch == '.').count() > 1) { | ||
return host.substring(0, host.indexOf(".")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will return only the last subdomain:
- ✅
test.com
resolves to:DEFAULT
- ✅
duper.test.com
resolves to:duper
- ❗
super.duper.test.com
resolves to:super
- Should be:
super.duper
- Should be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a test 2d717f8
…olver/AbstractSubdomainTenantResolver.java Co-authored-by: Guillermo Calvo <guillermocalvo@gmail.com>
…olver/PublicSuffixListSubdomainTenantResolver.java Co-authored-by: Guillermo Calvo <guillermocalvo@gmail.com>
Not sure what you mean, we have some tests: https://github.com/micronaut-projects/micronaut-multitenancy/blob/guava-compile-only/multitenancy/src/test/groovy/io/micronaut/multitenancy/tenantresolver/SubdomainTenantResolverEnabledSpec.groovy#L83-L92 |
Kudos, SonarCloud Quality Gate passed! |
@sdelamo You fixed the implementation here. Previously, it was simply returning |
Close: #225 #73