﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-一直在努力 !-随笔分类-读书笔记</title><link>http://www.blogjava.net/bluepluto/category/4222.html</link><description /><language>zh-cn</language><lastBuildDate>Tue, 29 Apr 2014 04:28:51 GMT</lastBuildDate><pubDate>Tue, 29 Apr 2014 04:28:51 GMT</pubDate><ttl>60</ttl><item><title>OAuth 2.0 Notes</title><link>http://www.blogjava.net/bluepluto/archive/2014/04/08/412118.html</link><dc:creator>一直在努力 !</dc:creator><author>一直在努力 !</author><pubDate>Tue, 08 Apr 2014 15:43:00 GMT</pubDate><guid>http://www.blogjava.net/bluepluto/archive/2014/04/08/412118.html</guid><wfw:comment>http://www.blogjava.net/bluepluto/comments/412118.html</wfw:comment><comments>http://www.blogjava.net/bluepluto/archive/2014/04/08/412118.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bluepluto/comments/commentRss/412118.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bluepluto/services/trackbacks/412118.html</trackback:ping><description><![CDATA[最近研究 CloudFoudry 需要了解 UAA 相关东西, 并学习了 OAuth 的相关知识. 在网上找到两篇文章写得比较好<br /><br />[1] http://blog.gopivotal.com/cloud-foundry-pivotal/products/open-standards-in-cloud-foundry-identity-services<br />[2] http://tutorials.jenkov.com/oauth2/index.html<br /><br />Summary<br /><div>Authorization Code 方式是最完整的, Client Application 会被重定向到 OAuth Server 登录并同意授权, 之后再返回业务系统, 业务系统通过 Authorization Code 在 OAuth Server 处获取访问最终 Resource Server 的 Access Token<br />Implicit 与 Authorization Code 大体类似, 只是少了用 Auhtorization Code 获取 AccessToken 的步骤<br />Resource Owner 方式是客户程序知道用户名和密码, 认证时连同自身的 Client ID 和密码一起发送到 OAuth Server, 比如 CF Java 客户端就是使用这种方式<br />Client Credentials 是 Client Application 本身就类似于 Resource Owner</div><br /><br /><div>1. OAuth Client 首先需要在 OAuth Server 注册, 需要提供一个 Redirect URL, 并从 OAuth Server 获取 Client ID 和 Client 密码<br />2. 基本流程<br />&nbsp;&nbsp;&nbsp; a. 用户访问客户端应用程序<br />&nbsp;&nbsp;&nbsp; b. 客户端应用重定向到 OAuth Server<br />&nbsp;&nbsp;&nbsp; c. 用户输入用户名和密码登录, OAuth Server 执行完 Authentication 后, 会提示用户是否允许访问数据<br />&nbsp;&nbsp;&nbsp; d. OAuth Server 使用注册的重定向 URL, 用户再次被定向到客户端应用程序, 此时 URL 会包含 Authentication Code<br />&nbsp;&nbsp;&nbsp; e. 客户端应用程序接收到请求后, 使用 Authentication Code/Client ID/Client Password 访问 OAuth Server 获取 Access Token<br />&nbsp;&nbsp; &nbsp;<br />3. OAuth 中四个角色<br />&nbsp;&nbsp;&nbsp; a. Resource Owner : One person or one application<br />&nbsp;&nbsp;&nbsp; b. Resource Server<br />&nbsp;&nbsp;&nbsp; c. Client Application<br />&nbsp;&nbsp;&nbsp; d. Authorization Server<br />&nbsp;&nbsp;&nbsp; * b 和 d 可以在一起, OAuth 规范未作详细规定, 其之间如何交互也无规定<br />&nbsp;&nbsp; &nbsp;<br />4. OAuth Client 类型<br />&nbsp;&nbsp;&nbsp; a. Confidential<br />&nbsp;&nbsp;&nbsp; b. Public<br />&nbsp;&nbsp;&nbsp; OAuth 客户端需要持用 Client ID 和 Client Password, 两种类型的区别在于, 第三方是否可以通过某种方式获取该信息.<br /><br />5. Client Profile<br />&nbsp;&nbsp;&nbsp; a. Web Application 指运行在 Web 服务器上的 Web 应用, 实际场景中, 还可能包含客户端浏览器&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; b. User Agent 比如运行在浏览器中的 JavaScript 应用<br />&nbsp;&nbsp;&nbsp; c. Native 比如桌面应用或者移动手机应用<br />&nbsp;&nbsp; &nbsp;<br />6. OAuth 2.0 Authorization<br />&nbsp;&nbsp;&nbsp; a. 注册到 OAuth 服务器, 一般执行一次, Client Application 会获取分配的 Client ID 和 Client Password. 注册过程中, Client Application 需要提供 Redirect URI<br />&nbsp;&nbsp;&nbsp; This redirect URI is used when a resource owner grants authorization to the client application. When a resource owner has successfully authorized the client application via the authorization server, the resource owner is redirected back to the client application, to the redirect URI. <br />&nbsp;&nbsp;&nbsp; b. 无论何时 Client Application 请求 Resource Server 上的资源时, Client Application 都需要到 OAuth Server 处使用 ID 和 密码执行认证<br />&nbsp;&nbsp; &nbsp;<br />7. Authorization Grant 指 Resource Owner 授予 Client Application. OAuth 2.0 定义了如何类型 :<br />&nbsp;&nbsp;&nbsp; a. Authorization Code<br />&nbsp;&nbsp;&nbsp; b. Implicit<br />&nbsp;&nbsp;&nbsp; c. Resource Owner Password Credentials<br />&nbsp;&nbsp;&nbsp; d. Client Credentials<br />&nbsp;&nbsp; &nbsp;<br />8. Authorization Code<br />&nbsp;&nbsp;&nbsp; a. 当 Client Application 重定向到 OAuth Server 时, Client ID 也会被传递过去, 这样 Authorization Server 可以知道哪个应用 (Client Application) 试图访问受保护资源<br />&nbsp;&nbsp;&nbsp; b. 当用户成功登录并授权访问后, OAuth Server 会使用 Client Application 注册时提供的 Redirect URI, 同时包含 Authentication Code.<br />&nbsp;&nbsp;&nbsp; c. Client Application 使用 Authentication Code, Client ID 和 Client Password 直接访问 Authorization Server, 并过去 Access Token. Access Token 代表 Client Application 通过认证和授权访问保护资源. (The access token serves as both authentication of the client, and authorization to access the resources. )<br />&nbsp;&nbsp; &nbsp;<br />9. Implicit 与 Authentication Code 工作方式类似, 区别在于重定向时, Access Token 被包含在内.<br />&nbsp;&nbsp;&nbsp; a. An implicit authorization grant is similar to an authorization code grant, except the access token is returned to the client application already after the user has finished the authorization. The access token is thus returned when the user agent is redirected to the redirect URI. <br />&nbsp;&nbsp;&nbsp; b. This of course means that the access token is accessible in the user agent, or native application participating in the implicit authorization grant. The access token is not stored securely on a web server.<br />&nbsp;&nbsp;&nbsp; c. Furthermore, the client application can only send its client ID to the authorization server. If the client were to send its client secret too, the client secret would have to be stored in the user agent or native application too. That would make it vulnerable to hacking.<br />&nbsp;&nbsp;&nbsp; d. Implicit authorization grant is mostly used in a user agent or native client application. The user agent or native application would receive the access token from the authorization server.<br />&nbsp;&nbsp; &nbsp;<br />10. Resource Owner Password Credentials 等价于, 用户 (Resource Owner) 把用户名密码告诉 Client Application, 然后 Client Application 直接使用用户名和密码访问 Resource Server<br />&nbsp;&nbsp;&nbsp;&nbsp; a. The resource owner password credentials authorization grant method works by giving the client application access to the resource owners credentials. For instance, a user could type his Twitter user name and password (credentials) into the client application. The client application could then use the user name and password to access resources in Twitter.<br />&nbsp;&nbsp;&nbsp;&nbsp; b. Using the resource owner password credentials requires a lot of trust in the client application. You do not want to type your credentials into an application you suspect might abuse it.<br />&nbsp;&nbsp;&nbsp;&nbsp; c. The resource owner password credentials would normally be used by user agent client applications, or native client applications. <br /><br />11. Client Credentials 使用 Client Application 需要调用 Resource Server 提供的一些功能, 但这些功能不和任何 Resource Owner 相关<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Client credential authorization is for the situations where the client application needs to access resources or call functions in the resource server, which are not related to a specific resource owner (e.g. user). For instance, obtaining a list of venues from Foursquare. This does not necessary have anything to do with a specific Foursquare user.<br />&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />12. OAuth 2.0 Endpoints<br />&nbsp;&nbsp;&nbsp; a. Authorization Endpoint<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The authorization endpoint is the endpoint on the authorization server where the resource owner logs in, and grants authorization to the client application.<br />&nbsp;&nbsp;&nbsp; b. Token Endpoint<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The token endpoint is the endpoint on the authorization server where the client application exchanges the authorization code, client ID and client secret, for an access token. <br />&nbsp;&nbsp;&nbsp; c. Redirection Endpoint<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The redirect endpoint is the endpoint in the client application where the resource owner is redirected to, after having granted authorization at the authorization endpoint.<br />&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; a 和 b 位于 Authorization Server 上, c 位于客户端应用程序上<br />&nbsp;&nbsp; &nbsp;<br />13. Authorization Code Grant Requests/Responses<br />&nbsp;&nbsp;&nbsp; a. Authorization Request<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a1. response_type &nbsp;&nbsp; &nbsp;Required. Must be set to code<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a2. client_id &nbsp;&nbsp; &nbsp;Required. The client identifier as assigned by the authorization server, when the client was registered.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a3. redirect_uri &nbsp;&nbsp; &nbsp;Optional. The redirect URI registered by the client.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a4. scope &nbsp;&nbsp; &nbsp;Optional. The possible scope of the request.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a5. state &nbsp;&nbsp; &nbsp;Optional (recommended). Any client state that needs to be passed on to the client request URI.<br />&nbsp;&nbsp;&nbsp; b. Authorization Response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The authorization response contains the authorization code needed to obtain an access token. Here are the parameters included in the response:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b1. code &nbsp;&nbsp; &nbsp;Required. The authorization code.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b2. state &nbsp;&nbsp; &nbsp;Required, if present in request. The same value as sent by the client in the state parameter, if any.<br />&nbsp;&nbsp;&nbsp; c. Authorization Error Response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If an error occurs during authorization, two situations can occur. <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The first is, that the client is not authenticated or recognized. For instance, a wrong redirect URI was sent in the request. In that case the authorization server must not redirect the resource owner to the redirect URI. Instead it should inform the resource owner of the error.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The second situation is that client is authenticated correctly, but that something else failed. In that case the following error response is sent to the client, included in the redirect URI:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c1. error &nbsp;&nbsp; &nbsp;Required. Must be one of a set of predefined error codes. See the specification for the codes and their meaning.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c2. error_description &nbsp;&nbsp; &nbsp;Optional. A human-readable UTF-8 encoded text describing the error. Intended for a developer, not an end user.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c3. error_uri &nbsp;&nbsp; &nbsp;Optional. A URI pointing to a human-readable web page with information about the error.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c4. state &nbsp;&nbsp; &nbsp;Required, if present in authorization request. The same value as sent in the state parameter in the request.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; d. Token Request<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Once an authorization code is obtained, the client can use that code to obtain an access token. Here is the access token request parameters:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d1. grant_type &nbsp;&nbsp; &nbsp;Required. Must be set to authorization_code .<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d2. code &nbsp;&nbsp; &nbsp;Required. The authorization code received by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d3. redirect_uri &nbsp;&nbsp; &nbsp;Required, if the request URI was included in the authorization request. Must be identical then.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; e. Token Response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The response to the access token request is a JSON string containing the access token plus some more information:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { "access_token"&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "token_type"&nbsp;&nbsp;&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "expires_in"&nbsp;&nbsp;&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "refresh_token" : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e1. The access_token property is the access token as assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e2. The token_type property is a type of token assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e3. The expires_in property is a number of seconds after which the access token expires, and is no longer valid. Expiration of access tokens is optional.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e4. The refresh_token property contains a refresh token in case the access token can expire. The refresh token is used to obtain a new access token once the one returned in this response is no longer valid. &nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />14. Implicit Grant Request<br />&nbsp;&nbsp;&nbsp;&nbsp; a. The implicit grant request contains the following parameters:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a1. response_type &nbsp;&nbsp; &nbsp;Required. Must be set to token .<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a2. client_id &nbsp;&nbsp; &nbsp;Required. The client identifier as assigned by the authorization server, when the client was registered.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a3. redirect_uri &nbsp;&nbsp; &nbsp;Optional. The redirect URI registered by the client.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a4. scope &nbsp;&nbsp; &nbsp;Optional. The possible scope of the request.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a5. state &nbsp;&nbsp; &nbsp;Optional (recommended). Any client state that needs to be passed on to the client request URI.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp; b.Implicit Grant Response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The implicit grant response contains the following parameters. Note, that the implicit grant response is not JSON.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b1. access_token &nbsp;&nbsp; &nbsp;Required. The access token assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b2. token_type &nbsp;&nbsp; &nbsp;Required. The type of the token<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b3. expires_in &nbsp;&nbsp; &nbsp;Recommended. A number of seconds after which the access token expires.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b4. scope &nbsp;&nbsp; &nbsp;Optional. The scope of the access token.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b5. state &nbsp;&nbsp; &nbsp;Required, if present in the autorization request. Must be same value as state parameter in request.<br /><br />&nbsp;&nbsp;&nbsp; c. Implicit Grant Error Response<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If an error occurs during authorization, two situations can occur.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The first is, that the client is not authenticated or recognized. For instance, a wrong redirect URI was sent in the request. In that case the authorization server must not redirect the resource owner to the redirect URI. Instead it should inform the resource owner of the error.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The second situation is that client is okay, but that something else happened. In that case the following error response is sent to the client, included in the redirect URI:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c1. error &nbsp;&nbsp; &nbsp;Required. Must be one of a set of predefined error codes. See the specification for the codes and their meaning.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c2. error_description &nbsp;&nbsp; &nbsp;Optional. A human-readable UTF-8 encoded text describing the error. Intended for a developer, not an end user.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c3. error_uri &nbsp;&nbsp; &nbsp;Optional. A URI pointing to a human-readable web page with information about the error.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c4. state &nbsp;&nbsp; &nbsp;Required, if present in authorization request. The same value as sent in the state parameter in the request.<br /><br />15. Credentials Grant - Requests and Response<br />&nbsp;&nbsp;&nbsp; a. Resource Owner Password Credentials Grant Request<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The request contains the following parameters:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a1. grant_type &nbsp;&nbsp; &nbsp;Required. Must be set to password<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a2. username &nbsp;&nbsp; &nbsp;Required. The username of the resource owner, UTF-8 encoded.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a3. password &nbsp;&nbsp; &nbsp;Required. The password of the resource owner, UTF-8 encoded.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a4. scope &nbsp;&nbsp; &nbsp;Optional. The scope of the authorization.<br /><br />&nbsp;&nbsp;&nbsp; b. Resource Owner Password Credentials Grant Response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The response is a JSON structure containing the access token. The JSON structure looks like this:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { "access_token"&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "token_type"&nbsp;&nbsp;&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "expires_in"&nbsp;&nbsp;&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "refresh_token" : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b1. The access_token property is the access token as assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b2. The token_type property is a type of token assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b3. The expires_in property is a number of seconds after which the access token expires, and is no longer valid. Expiration of access tokens is optional.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b4. The refresh_token property contains a refresh token in case the access token can expire. The refresh token is used to obtain a new access token once the one returned in this response is no longer valid. <br /><br />16. Client Credentials Grant - Requests and Response<br />&nbsp;&nbsp;&nbsp;&nbsp; a. The client credentials grant request contains the following parameters:<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a1. grant_type &nbsp;&nbsp; &nbsp;Required. Must be set to client_credentials .<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a2. scope &nbsp;&nbsp; &nbsp;Optional. The scope of the authorization.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<br />&nbsp;&nbsp;&nbsp; b. Client Credentials Grant Response<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; The client credentials response contains the following parameters:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; { "access_token"&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "token_type"&nbsp;&nbsp;&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "expires_in"&nbsp;&nbsp;&nbsp; : "...",<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b1. The access_token property is the access token as assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b2. The token_type property is a type of token assigned by the authorization server.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b3. The expires_in property is a number of seconds after which the access token expires, and is no longer valid. Expiration of access tokens is optional.<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; A refresh token should not be included for this type of authorization request.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div><img src ="http://www.blogjava.net/bluepluto/aggbug/412118.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bluepluto/" target="_blank">一直在努力 !</a> 2014-04-08 23:43 <a href="http://www.blogjava.net/bluepluto/archive/2014/04/08/412118.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>(你的灯还亮着么)这个问题是什么? </title><link>http://www.blogjava.net/bluepluto/archive/2005/10/27/17091.html</link><dc:creator>一直在努力 !</dc:creator><author>一直在努力 !</author><pubDate>Thu, 27 Oct 2005 11:16:00 GMT</pubDate><guid>http://www.blogjava.net/bluepluto/archive/2005/10/27/17091.html</guid><wfw:comment>http://www.blogjava.net/bluepluto/comments/17091.html</wfw:comment><comments>http://www.blogjava.net/bluepluto/archive/2005/10/27/17091.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bluepluto/comments/commentRss/17091.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bluepluto/services/trackbacks/17091.html</trackback:ping><description><![CDATA[故事讲的是四家公司参与政府资产投标,每家都想通过投标之前进行计算预测出投标时可能出现的情况,结果---<BR>&nbsp;&nbsp;&nbsp; 问题定义方面学到的:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a.不要把他们的解决方法误认为是问题的定义<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;b.如果你太轻易地解决了他们的问题，他们永远都不会相信你真的解决了他们的问题<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c.你永远都不能肯定你已经有了一个正确的定义，即使在问题已经解决之后。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; d.你永远也不能肯定你有了一个正确的定义，但是永远不要放弃寻求它的努力<BR><img src ="http://www.blogjava.net/bluepluto/aggbug/17091.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bluepluto/" target="_blank">一直在努力 !</a> 2005-10-27 19:16 <a href="http://www.blogjava.net/bluepluto/archive/2005/10/27/17091.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>温伯格&lt;&lt;你的灯亮着吗?&gt;&gt;(第一章 问题的定义) </title><link>http://www.blogjava.net/bluepluto/archive/2005/10/27/17090.html</link><dc:creator>一直在努力 !</dc:creator><author>一直在努力 !</author><pubDate>Thu, 27 Oct 2005 11:15:00 GMT</pubDate><guid>http://www.blogjava.net/bluepluto/archive/2005/10/27/17090.html</guid><wfw:comment>http://www.blogjava.net/bluepluto/comments/17090.html</wfw:comment><comments>http://www.blogjava.net/bluepluto/archive/2005/10/27/17090.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bluepluto/comments/commentRss/17090.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bluepluto/services/trackbacks/17090.html</trackback:ping><description><![CDATA[一.问题的提出:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 纽约市金融区的心脏地带矗立着一座闪亮耀眼的73 层大楼，这就是被人称为建筑学杰作的雷龙塔。然而，遗憾的是，尽管雷龙塔还没有被完全住满，房客们已经发现大楼的电梯不够用。甚至于有一些房客放出话来，如果电梯服务还不能很快得到改善的话，他们就会搬出大楼。<BR>下面列出了大楼的一些事实：<BR>1） 租赁大楼的大部分办公室在工作日的早上9 点到下午5 点之间办公。<BR>2） 几乎所有使用大楼的人们都与金融界有着某种方式的联系。<BR>3） 所有住户比较均匀地分布在大楼的73 层，电梯交通也一样。<BR>4） 房东为了把剩余房间租出去，已经在广告上做了大量的投资。<BR>5） 在金融区这个封闭的小圈子里，所有不好的消息传播得像闪电一样快<BR>二.问题的解决<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1)&nbsp;&nbsp;&nbsp; 确定问题的拥有者,不同的拥有者会有一系列对应的解决方案<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a.电梯使用者<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eg.修理电梯,限制进入大楼的人数......;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b.大楼管理员<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;eg.增加房租，只需要更少的房客就可以支付抵押贷款（建造大楼时所支出的）,设法说服客户，告诉他们正因为大楼是一个极好极方便的工作地点，所以才会有大楼目前的电梯状况...<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2)&nbsp;&nbsp;&nbsp;&nbsp; 对问题进行调研,房客希望尽快走完大门与办公室之间的距离;经验告诉我们,既然电梯无法提速,距离无法缩短,可以让他在走这段路时'忙碌'起来,于是在走廊里立起镜子,这样许多人会停下来看看自己今天帅不帅,这样电梯就不会挤......后又发现部分员工爱在镜子上涂鸦,导致镜子不匝地,既然这样,我给你笔,让所有人都能展示自己的才华,同样又达到了上述目的......<BR>三.总结<BR>&nbsp;&nbsp;&nbsp;&nbsp; 正如序言中所说,问题是期望与体验之间的差别,差别出现后,也就是问题被提出;<BR>&nbsp;&nbsp;&nbsp;&nbsp; a.最古老的方法:我不管,我没看到,我当他不存在,这个策略有时会有效<BR>&nbsp;&nbsp;&nbsp;&nbsp; b.立即针对差别提出解决方案<BR>&nbsp;&nbsp;&nbsp;&nbsp; c.确认问题的对象,定义问题的本质;<BR><FONT style="BACKGROUND-COLOR: #ffffff" color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一次失败的问题解决案例:</FONT><FONT style="BACKGROUND-COLOR: #0000ff"><BR></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 我在LY项目中做网上采购时,客户针对意向表列表提出&nbsp; :&nbsp; 我需要在这添加一个按钮时,我想通过点击他看到历史信息;此时客已户提出的解决方案,而<FONT color=#0000ff>与客户讨论前</FONT>我觉得问题是客户无法看到历史信息,或者说他期望对数据进行筛选;当然也许这也不是最终的问题所在,但是我所能看到最远的^_^.由于系统设计上的原因,我了解了一下,看似简单的添加一个按钮,需要改动的东西比较多,总之难.策略一我不管,似乎不行,客户因为一些前期的原因,对项目的满意程度不高,现在首要解决的是提高客户好感度;既然要关注这个问题,首先要摆出一个积极的姿态,我和他说问题已放入问题列表,且标注为high,这样给他一个印象,问题已经得到关注,他的意见得到了应有的重视(汗!,他是个LT,要是个MM那多好,哈哈);<FONT color=#0000ff>我之后和他讨论</FONT>这个问题,他说为啥要添这个按钮呢,原因是想让操作人员关注当前正在维护的记录,剔除历史记录有利于聚焦工作重点(事实上我并没有接触到最终用户,所以我也无从得知他们是否有这个需要),我明白了,问题进一步显现,是因为用户没有办法区分当前记录的状态(<FONT color=#ff0000>我当时晕了n把</FONT>),针对系统的实现,现在已有一个状态列,如果我按照状态排序,把当前未通过审核的意向表记录显示在前面,似乎也能解决问题,我想提出这个解决方案,我觉得挺完美,既解决了他的问题又解决了我实现难的问题,不过.....他说这样的话有可能有一页显示10条记录中,前九条是未通过审核的,最后一条是通过审核的,觉得还是不爽,并和我说:你能解决吗,不能解决就算了!搞得我很没面子,结局就是在系统中写了一些'诡异'的代码,实现了该要求.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 之后一直在想,撇除系统设计的缺陷外,为什么没能双赢的解决这个问题,象书中那样有创造性,结论是&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT color=#0000ff>我还很弱,还得继续看这本书,^_^!</FONT> <img src ="http://www.blogjava.net/bluepluto/aggbug/17090.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bluepluto/" target="_blank">一直在努力 !</a> 2005-10-27 19:15 <a href="http://www.blogjava.net/bluepluto/archive/2005/10/27/17090.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>温伯格&lt;&lt;你的灯亮着吗?&gt;&gt;(章柏幸的序言) </title><link>http://www.blogjava.net/bluepluto/archive/2005/10/27/17089.html</link><dc:creator>一直在努力 !</dc:creator><author>一直在努力 !</author><pubDate>Thu, 27 Oct 2005 11:12:00 GMT</pubDate><guid>http://www.blogjava.net/bluepluto/archive/2005/10/27/17089.html</guid><wfw:comment>http://www.blogjava.net/bluepluto/comments/17089.html</wfw:comment><comments>http://www.blogjava.net/bluepluto/archive/2005/10/27/17089.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/bluepluto/comments/commentRss/17089.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/bluepluto/services/trackbacks/17089.html</trackback:ping><description><![CDATA[1.智者回答如何才能快乐的解决所遇到的问题:把自己当别人,把别人当自己,把自己当自己,把别人当别人;<BR>&nbsp;&nbsp;&nbsp; 我的理解是遇到问题要多站在别人的角度看,同时要认识到自己与别人所处的位置的不同<BR>2.解决问题的基本步骤:<BR>&nbsp;&nbsp; a.抓住问题的根源;eg.客户提出某个变更后,首先想到的是他为什么会提出变更,再根据这个原因与之商定解决方案<BR>&nbsp;&nbsp; b.站在各个角度看待问题,方能知道问题的根本;即使找到解决方案后,仍需要对其不断审核,保持警惕心<BR>&nbsp;&nbsp; c.区分问题的定义和解决方案;eg.客户提出的往往是解决方案而不是导致的根源<BR>&nbsp;&nbsp; d.永远不要肯定自己已经解决问题了,即使everything goes well!(^_^,这不是折腾自己吗)<BR>3.问题的定义:问题其实就是你的期望和你的感受之间的差别，而且不管看上去如何，人们很少知道他们要什么..直到..你给了他们所需要的东西.<img src ="http://www.blogjava.net/bluepluto/aggbug/17089.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/bluepluto/" target="_blank">一直在努力 !</a> 2005-10-27 19:12 <a href="http://www.blogjava.net/bluepluto/archive/2005/10/27/17089.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>