How reconnect Data source after login authentication in grails?



I want to access different databases for each user and I want to identify the database source at the time of login.

I have a core database where users’ access and database URL information are exist. At the time of login, user will enter username and password for login then check authentication with the core database first. If the user has authorization, user will reconnect his database source with database URL information.

No references are available. I am not sure about Grails support configuration and usage of multiple data sources at the run time.

NB: I use the spring security core plugin there.