How to configure Multi-tenant plugin as single-tenant with Spring security plugin as resolver?
Posted
by
Fabien Barbier
on Stack Overflow
See other posts from Stack Overflow
or by Fabien Barbier
Published on 2010-12-08T00:32:49Z
Indexed on
2011/11/20
1:50 UTC
Read the original article
Hit count: 442
I can create a secure, multi-tenant web app with Grails by :
- setup spring security plugin,
- setup Multi-tenant plugin (via multi-tenant install and multi-tenant-spring-security)
update config.groovy :
tenant { mode = "multiTenant" resolver.type = "springSecurity" }
add : Integer userTenntId in User domain
- add a domain class for tenant Organization
- associate the tenants with Organization
- Edit BootStrap.groovy.
Everything works fine in multi-tenant mode, but how to use mode = "singleTenant" ?
This configuration sound not working :
tenant { mode = "singleTenant" resolver.type = "springSecurity" }
Edit :
I try this config :
tenant {
mode = "singleTenant"
resolver.type = "springSecurity"
datasourceResolver.type = "config"
dataSourceTenantMap {
t1 = "jdbc:hsqldb:file:custFoo"
t2 = "jdbc:hsqldb:file:custBar"
}
}
But I get :
ERROR errors.GrailsExceptionResolver - Executing action [list] of controller [org.example.TicketController] caused exception: java.lang.StackOverflowError
and :
Caused by: java.lang.StackOverflowError
at org.grails.multitenant.springsecurity.SpringSecurityCurrentTenant.getTenantIdFromSpringSecurity(SpringSecurityCurrentTenant.groovy:50)
at org.grails.multitenant.springsecurity.SpringSecurityCurrentTenant.this$2$getTenantIdFromSpringSecurity(SpringSecurityCurrentTenant.groovy)
at org.grails.multitenant.springsecurity.SpringSecurityCurrentTenant$this$2$getTenantIdFromSpringSecurity.callCurrent(Unknown Source)
at org.grails.multitenant.springsecurity.SpringSecurityCurrentTenant.get(SpringSecurityCurrentTenant.groovy:41)
at com.infusion.tenant.spring.TenantBeanContainer.getBean(TenantBeanContainer.java:53)
at com.infusion.tenant.spring.TenantMethodInterceptor.invoke(TenantMethodInterceptor.java:32)
at $Proxy14.getConnection(Unknown Source)
© Stack Overflow or respective owner