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

Oauth2 JdbcTokenStore not using tenant current schema #2

Open
AnuvadiyaHiren opened this issue Oct 15, 2018 · 0 comments
Open

Oauth2 JdbcTokenStore not using tenant current schema #2

AnuvadiyaHiren opened this issue Oct 15, 2018 · 0 comments

Comments

@AnuvadiyaHiren
Copy link

AnuvadiyaHiren commented Oct 15, 2018

I have implemented schema based tenancy with postgresql, but i encounter problem with JdbcTokenStore. it uses default schema which result to fail query

@component
@order(1)
public class TenantFilter implements Filter {

private static final String TENANT_HEADER = "X-Tenant-Id";


@Override
public void init(FilterConfig filterConfig) throws ServletException {
}

@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
    HttpServletResponse response = (HttpServletResponse) servletResponse;
    HttpServletRequest request = (HttpServletRequest) servletRequest;
    String tenantHeader = request.getHeader(TENANT_HEADER);
    if (tenantHeader != null && !tenantHeader.isEmpty()) {
        TenantContext.setCurrentTenant(tenantHeader);

    }
    filterChain.doFilter(servletRequest, servletResponse);
}

@Override
public void destroy() {
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant