简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM