1

I have a project that needs to be split into two webservers. Both of them however should use the same domain class for login of users. From reading all over the web I got the idea that making a plugin with the spring security domain classes and using it in the webserver-projects would be a good idea, but I can't get it to work. I got so many different error messages, I don't even know if anything I am doing is a good idea.

What would be the recommended way to create a library/plugin that can be used to include domain classes meant to be used for other grails projects?

Roughly my current setup is this:

  1. create plugin project
  2. create webserver project
  3. add spring security to the plugin project
  4. use s2-quickstart to generate User and Role in the plugin project
  5. setup the two projects as a multiproject with a respective settings.gradle
  6. add compile project(:plugin) to the webserver project
  7. copy over the spring security configuration from the plugin project to the webserver project
  8. add some default users to the webserver project via setup code in Bootstrap.groovy
  9. run the webserver and try to login

However currently my problem with this is that it fails to login, it just tells me "that user does not exist".

Is there any known way of doing this? I've searched around a lot, but either things don't work at all like described in tutorials or the tutorials are for grails 2.

Cola_Colin
  • 415
  • 5
  • 16
  • This is the correct way. We have it setup like that. If no user found error is shown, you can debug spring security classes and see what is going on. You can also turn on `logSql` to see if and what query is done to check user – practical programmer Mar 09 '16 at 11:16
  • It appears my problem is that the springSecurityService that is supposed to be injected into my User-Class is null, so it does not encode the password. This in turn causes issues as the login-check does assume a hashed password. So somehow it seems the dependency injection isn't working for the springSecurityService – Cola_Colin Mar 09 '16 at 13:03
  • The reason why dependency injection fails is because I changed the generated Domain Classes, due to other errors. See here : http://stackoverflow.com/questions/35892934/arrayindexoutofboundsexception-0-in-this-of-grails-domain-class – Cola_Colin Mar 09 '16 at 13:27

0 Answers0