简体   繁体   English

在Java中实现OAuth协议

[英]Implementing OAuth protocol in Java

I'm looking for an open source library that implements the OAuth protocol , I need the server side implementation . 我正在寻找一个实现OAuth协议的开源库,我需要服务器端实现。 Say I have a Social network system , and I want to give my users an OAuth abiliy to my API , like facebook. 假设我有一个社交网络系统,我想给我的用户一个OAuth abiliy到我的API,比如facebook。

Do you have any suggestion , sure examples . 你有什么建议吗,肯定的例子。

There are few Java libraries list here, 这里列出的Java库很少,

http://oauth.net/code/ http://oauth.net/code/

You should use the first one. 你应该使用第一个。 It's the only one with server support. 它是唯一一个支持服务器的人。 You can find an example, 你可以找一个例子,

http://oauth.googlecode.com/svn/code/java/example/oauth-provider/ http://oauth.googlecode.com/svn/code/java/example/oauth-provider/

You might want also look at OAuth 2.0, 您可能还想看看OAuth 2.0,

http://tools.ietf.org/html/draft-ietf-oauth-v2-02 http://tools.ietf.org/html/draft-ietf-oauth-v2-02

Which greatly simplifies OAuth flow and you don't really need a library to implement it. 这极大地简化了OAuth流程,您实际上并不需要库来实现它。

You can try https://github.com/apifest/apifest-oauth20 It's written in Java and uses Netty as a server. 您可以尝试https://github.com/apifest/apifest-oauth20它是用Java编写的,并使用Netty作为服务器。 As a storage, it currently uses Hazelcast(by default), MongoDB or Redis. 作为存储,它目前使用Hazelcast(默认情况下),MongoDB或Redis。 Also, you can easily add another backend storage. 此外,您可以轻松添加另一个后端存储。

If you are willing to implement oauth server using a Java Spring technologies. 如果您愿意使用Java Spring技术实现oauth服务器。

Here is an implementation using Spring Boot. 这是一个使用Spring Boot的实现。

https://github.com/dsyer/sparklr-boot https://github.com/dsyer/sparklr-boot

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

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