Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share Spring Security classes between a Grails app and a Java app?

I need to use the Spring Security User, Role/Authority and the UserRole-join classes both in a Grails application and a Java app.

Where and how should I implement/generate these classes?

If I use the generated GORM/Groovy classes from Grails, how would I import and use them in the Java app (where I handle the Hibernate session factory myself)?

Or would I implement them in Java as Hibernate Entities and import/use them in the Grails app? (I have done this successfully before with 'normal' (none-Spring Security) classes, but I would not know whether/how to implement the get, create, remove, removeAll methods that the Spring Security Core plugin has generated)

like image 707
thomers Avatar asked Nov 13 '22 22:11

thomers


1 Answers

I've an grails app where your second option is used.

There is an separate module for data manipulations, because this project have two different standalone apps (grails website and backend processor with REST api), and also it uses MongoDB (so, all this GORM magic doesn't help there).

And Spring Security used on both sides (web and backend), with different implementations, but everything works fine. Actually it requires some little work on implementing required beans (look inside Spring Security Core plugin), but it isn't so complicated.

like image 127
Igor Artamonov Avatar answered Dec 16 '22 12:12

Igor Artamonov