简体   繁体   English

如何在 Grails 应用程序和 Java 应用程序之间共享 Spring 安全类?

[英]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.我需要在 Grails 应用程序和 Java 应用程序中使用 Spring 安全用户、角色/权限和 UserRole-join 类。

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)? 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?或者我会在 Java 中将它们实现为 Hibernate 实体并在 Grails 应用程序中导入/使用它们? (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) (我之前使用“普通”(非 Spring 安全)类成功完成了此操作,但我不知道是否/如何实现 Spring 安全核心插件生成的 get、create、remove、removeAll 方法)

I've an grails app where your second option is used.我有一个 grails 应用程序,其中使用了您的第二个选项。

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).有一个单独的数据操作模块,因为这个项目有两个不同的独立应用程序(grails 网站和带有 REST api 的后端处理器),并且它还使用 MongoDB(所以,所有这些 GORM 魔法都无济于事)。

And Spring Security used on both sides (web and backend), with different implementations, but everything works fine.和 Spring 双方(Web 和后端)使用的安全性,具有不同的实现,但一切正常。 Actually it requires some little work on implementing required beans (look inside Spring Security Core plugin), but it isn't so complicated.实际上,实现所需的 bean 需要做一些小工作(查看 Spring 安全核心插件),但它并不复杂。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Java Web应用程序和普通Java应用程序之间共享代码 - How to share code between a Java Web app and a normal Java app Spring Security中如何在子域之间共享会话 - How to share session between subdomain in Spring Security 在Java App和Web App之间共享实例 - Share instance between Java App and Web App 使用Spring MVC后端的Spring Security for Grails应用程序 - Spring Security for Grails app using Spring MVC backend AWS-如何在Java Web应用程序的子域和域之间共享会话? - AWS - How to share session between subdomain and domain for a Java web app? 如何在Google App Engine Java应用程序的模块之间共享会话? - How to share sessions between modules on a Google App Engine Java application? java如何在类之间共享字段和方法 - java how to share field and method between classes 如何在Java中的不同类之间共享数据 - How to share data between separate classes in Java 具有Spring Security 3.2.3的Java Web App无需部署 - Java Web App With Spring Security 3.2.3 No Deploy 如何在Spring Boot Security OAuth2应用程序中仅对某些类启用OAuth2? - How do I enable OAuth2 for only certain classes in my Spring Boot Security OAuth2 app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM