Skip to content

Add MultiTenantAuthenticationManagerResolver #6976

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

Closed
jzheaux opened this issue Jun 12, 2019 · 2 comments
Closed

Add MultiTenantAuthenticationManagerResolver #6976

jzheaux opened this issue Jun 12, 2019 · 2 comments
Assignees
Labels
in: web An issue in web modules (web, webmvc)
Milestone

Comments

@jzheaux
Copy link
Contributor

jzheaux commented Jun 12, 2019

There ought to be a simple way to configure multi-tenancy for common use cases like by domain, by path, and by header.

Being able to do something like

@Bean 
public AuthenticationManagerResolver<HttpServletRequest> byHeader
        (Converter<String, AuthenticationManager> lookupByTenant) {
    return DefaultAuthenticationManagerResolver.resolveByHeaderValue
            ("X-Tenant-Id", lookupByTenant);
}

might be nice.

@jzheaux jzheaux added this to the 5.2.x milestone Jun 12, 2019
@jzheaux jzheaux self-assigned this Jun 12, 2019
@jzheaux jzheaux added in: web An issue in web modules (web, webmvc) type: improvement labels Jun 12, 2019
@rwinch rwinch changed the title Introduce ServletAuthenticationManagerResolvers Add ServletAuthenticationManagerResolver Jun 13, 2019
@jzheaux jzheaux changed the title Add ServletAuthenticationManagerResolver Add AuthenticationManagerResolvers Jun 13, 2019
@rwinch
Copy link
Member

rwinch commented Jun 13, 2019

Some thoughts...perhaps create DefaultAuthenticationManagerResolver which allows injecting a Converter for the request to be converted into an id and then another Converter for the id to be converted into a manager. Then static factory methods on it that resemble byHeader as shown above

@jzheaux
Copy link
Contributor Author

jzheaux commented Jun 14, 2019

We could achieve the same thing with:

static <T> AuthenticationManagerResolver<HttpServletRequest> resolveByRequestConverter
        (Converter<HttpServletRequest, T> requestConverter, 
                Converter<T, AuthenticationManager> resolver)

However, I do like the idea of a concrete implementation that can hold state. I've updated the PR accordingly.

@jzheaux jzheaux changed the title Add AuthenticationManagerResolvers Add DefaultAuthenticationManagerResolver Jun 14, 2019
jzheaux added a commit to jzheaux/spring-security that referenced this issue Jun 24, 2019
A class with a number of handy request-based implementations of
AuthenticationManagerResolver targeted at common multi-tenancy
scenarios.

Fixes: spring-projectsgh-6976
@jzheaux jzheaux modified the milestones: 5.2.x, 5.2.0.RC1 Jun 27, 2019
@jzheaux jzheaux changed the title Add DefaultAuthenticationManagerResolver Add MultiTenantAuthenticationManagerResolver Jun 27, 2019
kostya05983 pushed a commit to kostya05983/spring-security that referenced this issue Aug 26, 2019
A class with a number of handy request-based implementations of
AuthenticationManagerResolver targeted at common multi-tenancy
scenarios.

Fixes: spring-projectsgh-6976
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc)
Projects
None yet
Development

No branches or pull requests

2 participants