`
djb4ke
  • 浏览: 55158 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

OAuth in OpenSocial 序篇

阅读更多

OAuth的基本概念

这个不是本文重点,不过我在学习OAuth中也总结了一些有用的资料:

  1. OAuth官方网站 : http://oauth.net/
  2. OAuth教程Blog : http://hueniverse.com/oauth/
  3. Google OAuth : http://code.google.com/apis/accounts/docs/OAuth.html
  4. 附件是我最初学习OAuth做的PPT,里面把一些经典的例子都涉及到了,有兴趣的可以看一下。
  5. Demo OAuth的好地方,OAuth Playground : http://googlecodesamples.com/oauth_playground/
  6. 另一个OAuth Demo : http://oauthexample.appspot.com/Welcome



 

重点还是关注OpenSocial中的OAuth应用:

主要参考文章:http://wiki.opensocial.org/index.php?title=OAuth_Use_Cases

 

OpenSocial中OAuth的需求

OpenSocial需要OAuth,是很容易理解的,因为OpenSocial的API基本都是取私人数据的,比如如下图的Gadget,是获取Google的联系人,这是非常隐私的私人数据,此处虽然是在Google的ig中取Google的联系人,并且用户在登录状态,但是仍可使用或者某些场景需要OAuth来取私人数据,为什么?

虽然都在Google内,但是我们得分开考虑:

  • ig是个gadget容器,实际上可以理解为Gadget的App Server,在OAuth中为Consumer.
  • 我们要取的联系人是Google的一项服务,实现了Open Social的API,在OAuth中为SP Provider

 
 

 

OAuth 签名用到的key

Consumer Key 和 Secret

对于需要用到OAuth的Gadget,他们都有一对自己使用的Consumer Key和Secret.

这对Key保存在两个地方:

①Social Network:上例就是联系人服务的server,如果通过OAuth的方式取联系人,要在此Server上注册一对Consumer Key和Secret.

②Gadget容器所属的App server:这里也要保存的原因是,Gadget本身不具备发起OAuth Request的能力,OAuth签名等操作实际是在App Server中进行的,因此App Server需要保存这对Key。

保存方式是建立关系映射,例如 mygadget:key&secret,这样gadget发起OAuth请求(此请求非实际请求,而是请求App server作为代理代发OAuth请求的请求+_+),Gadget容器就知道应该使用哪对Key&Secret签名。

这也就建立了Gadget与App Server的联系。

 

还拿上面的例子(并非真相,只是做例子解说),简而言之,Gadget的作者写完取google联系人的gadget后,在google联系人server的OAuth注册处注册了一对key&secret,随后,在gadget容器,也将此key&secret保存(我现在很后悔用ig和google联系人做例子,因为Google可能不需要这么麻烦的= =#,如果是两个不相干的App Server和social network,则这个流程是必须的..,实际上Google注册key&secret时按Domain来的,不过我没domain%>_<%,所以也不清楚真相,有domain的可以到下面的link尝试一下https://www.google.com/accounts/ManageDomains)

 

用来验证Gadget所用key&secret的link : https://www.google.com/gadgets/directory/verify

 

 

public/private Key

有些Gadget容器不但支持Consumer Key和Secret的方式签名。

还支持非对称加密,这个很好理解:

Gadget容器保存自己的keystore,即私钥,用来对OAuth签名,然后将证书发布出去。

Social Site保存证书,以便取得公钥,用来验签名

 

下面这个link可以得到各大Gadget容器的证书:https://opensocialresources.appspot.com/certificates/

  

 

 OpenSocial and 3-legged OAuth

>点我链接至< :OAuth in OpenSocial-第一篇:3-legged OAuth实例分析

 

 

 

 

 OpenSocial and 2-legged OAuth

 

>点我链接至< : OAuth in OpenSocial-第二篇:2-legged OAuth

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  • 大小: 1.4 KB
  • 大小: 129.1 KB
分享到:
评论

相关推荐

    OAuth 2.0 in Action

    OAuth 2.0 in Action OAuth 2.0 in Action OAuth 2.0 in Action OAuth 2.0 in Action OAuth 2.0 in Action

    oauth2.in.action

    We want you to come away from this book with a deep understanding of what OAuth can do, why it works the way that it does, and how to deploy it properly and securely in an unsafe internet. ...

    OAuth2资源集合(Oauth2 in Action,OAuth2.0 Cookbook,Getting Started with OAuth 2.0)

    包含 1.Getting Started with OAuth 2.0.pdf 2.Mastering OAuth 2.0.pdf 3.Oauth2 in Action.pdf 4.OAuth2.0 Cookbook.pdf

    Oauth2.0 in Action

    OAuth 2 in Action teaches you the practical use and deployment of this HTTP-based protocol from the perspectives of a client, authorization server, and resource server. You'll learn how to confidently...

    OAuth2 in Python.pdf

    OAuth2 in Python.pdf

    OAuth.2.in.Action.pdf

    OAuth.2.in.Action.pdf,本资源转载自网络,如有侵权,请联系上传者或csdn删除。

    OAuth2.in.Action.2017.3.pdf

    OAuth2.in.Action.2017.3.pdf

    Oauth2 in action

    Oauth2 in action英文版,第三方用户账号认证,客户端段认证,网络安全

    OAuth2.0协议中文版.pdf

    OAuth2.0是OAuth协议的延续版本,但不向前兼容OAuth 1.0(即完全废止了OAuth1.0)。 OAuth 2.0关注客户端开发者的简易性。要么通过组织在资源拥有者和HTTP服务商之间的被批准的交互动作代表用户,要么允许第三方应用...

    OAuth2 in Python.zip

    OAuth2 in Python

    OAuth2.0 中文译本

    rft6749 OAuth2.0中文译本,免费下载。

    spring-security-oauth2-2.3.5.RELEASE-API文档-中文版.zip

    赠送jar包:spring-security-oauth2-2.3.5.RELEASE.jar; 赠送原API文档:spring-security-oauth2-2.3.5.RELEASE-javadoc.jar; 赠送源代码:spring-security-oauth2-2.3.5.RELEASE-sources.jar; 赠送Maven依赖信息...

    Java的oauth2.0 服务端与客户端的实现 (完整源码、demo)

    Java的oauth2.0 服务端与客户端的实现.zip 封装了oauth2.0的基本架构和实现,对照我的博客http://blog.csdn.net/jing12062011/article/details/78147306使用该源码。 下载项目压缩包,解压,里面两个maven项目:...

    oauth-in-action-code:行动中的OAuth 2的源代码-Source code

    OAuth 2 in Action从客户端,授权服务器和资源服务器的角度教您该协议的实际使用和部署。 您将从OAuth的概述开始,并了解其组件和交互。 然后,使用大量动手示例,您将构建您的第一个OAuth客户端,然后构建一个授权...

    springboot+oltu.oauth2搭建oauth2环境

    springboot和apache的开源项目org.apache.oltu.oauth2组合搭建的oauth2环境,一般的oauth配置下就可以用了,但是我这个项目,是用原理上讲如何搭建oauth2,哪个controller转发到哪个controller,为什么这样,都有...

    Spring Security oauth2

    #OAuth2-Defender ##主要技术 Maven Spring Boot Spring Security Spring Security OAuth2.0 MySQL ##修改数据库配置 修改defender-oauth2-authorization\src\main\resources\...

    阮一峰_理解OAuth 2.01

    一、应用场景为了理解OAuth的适用场合,让我举一个假设的例子 二、名词定义在详细讲解OAuth 2.0之前,需要了解几个专用名词 三、OAuth的思路OAut

Global site tag (gtag.js) - Google Analytics