使用OAuth连接与应用GAE Java应用程序 [英] Using Oauth to connect a Java application with a GAE application

查看:161
本文介绍了使用OAuth连接与应用GAE Java应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java应用程序和应用GAE,发送C2DM消息的Andr​​oid设备。

I have a Java application and a GAE application, that sends C2DM messages to Android devices.

现在我想使Java应用程序的用户能够登录通过他们的谷歌账号到GAE应用程序。我是正确,我需要使用OAuth实现这一点?

Now I would like to make the users of the java application able to sign in via their Google accounts to the GAE application. Am I correct, that I need to use oauth to realize this?

背景豆蔻位:

+-----------+                        +----------+
| JAVA App  |  send Message to --->  | GAE App  | 
+-----------+                        +----------+
  ^                                         |
  | Notify Client                           |
  ---------------------------- <User is allowed to send>
                                            |
                                            |
                                          [YES] ---> Start delivering C2DMessage

我希望我的伟大的ASCII画面更容易理解;)

I hope my great ASCII picture make it easier to understand ;)

不知怎的,我需要允许用户在他们的谷歌凭据Java应用程序登录,如果我将消息发送到服务器的用户数据正在与消息发送给服务器。

Somehow I need to allow the user to login in the java application with their google credentials and if I send a message to the server the user data is being sent with the message to the server.

我真的没有一个想法如何做到这一点。这将是巨大的,如果你能告诉我,wheter我对正确或错误的轨道。我会的任何建议真的很高兴。

I do not really have an idea how to do this. It would be great, if you could tell me, wheter I am on the right or wrong track. I would be really glad for any suggestions.

谢谢,马克

推荐答案

当你的应用程序需要访问的资源或用户的代表另一个业务进行操作(无需凭据)的OAuth使用。

OAuth is used when your application need to access resources or perform operation on another service on the behalf of the user (without needing their credentials).

根据什么是Java应用程序(桌面,网络,移动电话),您将使用不同的OAuth的流程如图所示的验证文档,谷歌API的的。

Depending on what is your Java application (desktop, web, mobile), you will use different OAuth flow as shown in the Auth documentation for Google APIs.

和无需用户在Java应用程序登录,只要他们在GAE应用程序登录,您应该能够从GAE OAuth的终点检索访问令牌。

And no need for the user to login in the Java application, as long as they are logged in the GAE application, you should be able to retrieve an Access Token from GAE OAuth end points.

注意GAE只支持OAuth的1.0,为OAuth提供者行事时,看到的 GAE的OAuth Documentatio n表示更多的细节。

Note that GAE only support OAuth 1.0, when acting as an OAuth provider, see the GAE OAuth Documentation for more details.

此外Ikai最近做了一个的博客文章详细介绍了如何设置在GAE / Java中的OAuth提供者。

Also Ikai recently made a blog post detailing how to setup a OAuth provider on GAE/Java.

作为一个方面说明,你看看最新版本GPE,设有模具开发与GAE后端Android应用程序,如展会在今年的谷歌I / O presentation

As a side note, did you take a look at the latest GPE version, it features tooling for developing Android Application with a GAE backend, as show in this year Google I/O presentation

希望有所帮助。

这篇关于使用OAuth连接与应用GAE Java应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆