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

Multiple implementations of Subdomain tenant resolver supporting every domain suffix #234

Merged
merged 18 commits into from
Sep 12, 2023

Conversation

sdelamo
Copy link
Contributor

@sdelamo sdelamo commented Sep 11, 2023

Close: #225 #73

@sdelamo sdelamo added type: improvement A minor improvement to an existing feature type: bug Something isn't working labels Sep 11, 2023
Copy link

@guillermocalvo guillermocalvo left a 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 🤔

return TenantResolver.DEFAULT;
protected Serializable resolveSubdomain(@NonNull String host) {
if (host.chars().filter(ch -> ch == '.').count() > 1) {
return host.substring(0, host.indexOf("."));

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

Copy link
Contributor Author

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

sdelamo and others added 4 commits September 11, 2023 21:53
…olver/AbstractSubdomainTenantResolver.java

Co-authored-by: Guillermo Calvo <guillermocalvo@gmail.com>
…olver/PublicSuffixListSubdomainTenantResolver.java

Co-authored-by: Guillermo Calvo <guillermocalvo@gmail.com>
@sdelamo sdelamo linked an issue Sep 11, 2023 that may be closed by this pull request
@sdelamo
Copy link
Contributor Author

sdelamo commented Sep 11, 2023

I don't think SubdomainTenantResolver will resolve hostnames properly as it is now 🤔

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

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

94.4% 94.4% Coverage
0.0% 0.0% Duplication

@guillermocalvo
Copy link

I don't think SubdomainTenantResolver will resolve hostnames properly as it is now 🤔

Not sure what you mean, we have some tests:

@sdelamo You fixed the implementation here. Previously, it was simply returning host.substring(0, host.indexOf("."));. That's what I meant.

@sdelamo sdelamo merged commit eca19f0 into master Sep 12, 2023
7 checks passed
@sdelamo sdelamo deleted the guava-compile-only branch September 12, 2023 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working type: improvement A minor improvement to an existing feature
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

URLs beginning with www.
2 participants