简体   繁体   English

Play 2.3.x中的身份验证

[英]Authentication in Play 2.3.x

I'm using the Play! 我正在使用Play! framework v2.3 (Java) and I want to add some user authentication to my web app, ie username/password for each user and a registration process. 框架v2.3(Java),我想在我的网络应用程序中添加一些用户身份验证,即每个用户的用户名/密码和注册过程。

I found some information on the docs on how to do this for v2.1 and v2.2: http://www.playframework.com/documentation/2.1.0/JavaGuide4 https://www.playframework.com/documentation/2.2.x/JavaGuide4 我找到了有关如何为v2.1和v2.2执行此操作的文档的一些信息: http //www.playframework.com/documentation/2.1.0/JavaGuide4 https://www.playframework.com/documentation/的2.2.x / JavaGuide4

But I can't find any updated info on v2.3. 但我在v2.3上找不到任何更新的信息。 I've already tried looking at the API for play.mvc.Security.Authenticated but it doesn't help ( http://www.playframework.com/documentation/2.3.x/api/java/play/mvc/Security.Authenticated.html ). 我已经尝试过查看API for play.mvc.Security.Authenticated但它没有用( http://www.playframework.com/documentation/2.3.x/api/java/play/mvc/Security。 Authenticated.html )。

Anyone know how to do this properly? 谁知道如何正确地做到这一点?

There are a number of authentication libraries that already exist which cover many use cases. 有许多已经存在的认证库,涵盖了许多用例。 It'd be best to use something that's well established in the community. 最好使用在社区中建立的东西。

Secure Social - This seems to be the most popular, with lots of documentation. 安全社交 - 这似乎是最流行的,有很多文档。 (For both java and scala) (对于java和scala)

Deadbolt 2 - There are many implementation examples linked from that git repo. Deadbolt 2 - 从git repo链接了许多实现示例。 It seems a little more geared for java. 它似乎更适合java。

Play2 Auth - This is for scala only, but it is well documented and very flexible. Play2 Auth - 这仅适用于scala,但它有详细记录且非常灵活。 (I personally use Play2 Auth) (我个人使用Play2 Auth)

Out there is another greate authentication library called Silhouette for Play Framework applications (Scala) that supports several authentication methods, including OAuth1, OAuth2, OpenID, Credentials, Basic Authentication, Two Factor Authentication or custom authentication schemes. 另外还有一个名为Silhouette for Play Framework应用程序(Scala)的greate身份验证库,它支持多种身份验证方法,包括OAuth1,OAuth2,OpenID,凭据,基本身份验证,双因素身份验证或自定义身份验证方案。 http://silhouette.mohiva.com http://silhouette.mohiva.com

It is very well maintained and the stable version 3.0.0 got announced just a couple days ago: http://silhouette.mohiva.com/blog/stable-release-of-silhouette-300 维护得非常好,稳定版3.0.0在几天前刚刚公布: http//silhouette.mohiva.com/blog/stable-release-of-silhouette-300

The cooles thing is, the project is named after the fictional crime fighter character Silhouette, from the Watchmen graphic novel and movie. 这个项目是以虚构的犯罪斗士角色剪影命名的,来自守望者的图画小说和电影。

I found this Play template which covers logging in, resetting password, etc... 我找到了这个Play模板,其中包括登录,重置密码等...

https://typesafe.com/activator/template/PlayStartApp https://typesafe.com/activator/template/PlayStartApp

Our company have published an OpenSource Cloud Platform As a Service Web UI (for Play Framework 2.2.2). 我们公司已经发布了一个OpenSource云平台即服务Web UI(适用于Play Framework 2.2.2)。

We are planning to migrate it to 2.3.X over the next few weeks, even though we had some incompatibility at first that we need to look at. 我们计划在接下来的几周内将其迁移到2.3.X,尽管我们首先需要考虑一些不兼容性。

You can view short video's of our work at http://www.acentera.com/opensource/ ; 您可以在http://www.acentera.com/opensource/查看我们工作的简短视频; from there you will be able to find our Public Git Repository of the code, which in some cases need improvements but hopefully can be a good start for you to use this great web framework. 从那里你将能够找到我们的公共Git存储库的代码,在某些情况下需要改进,但希望是一个良好的开端,你可以使用这个伟大的Web框架。

We used shiro as authentication with a custom "SampleRealm" that does the JDBC Authentication and get proper "permissions", with memcache as sessions store in order to keep stateless connections. 我们使用shiro作为身份验证,使用自定义“SampleRealm”进行JDBC身份验证并获得正确的“权限”,将memcache作为会话存储,以保持无状态连接。

Regards, Eric M. ACenterA Inc. 此致,Eric M. ACenterA Inc.

Play authenticate is since beginning not only for scala but for java too, it have deadbolt embedded... Social secure, stateless with plenty of examples : 播放身份验证从一开始不仅适用于scala,而且适用于java,它也有嵌入式死锁...社交安全,无状态,有大量示例:

https://github.com/joscha/play-authenticate https://github.com/joscha/play-authenticate

it is the best customizable authentication module to use 它是最好的可自定义身份验证模块

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

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