From b3818cfb05f5b7de0f76c740763c35267a5f6cb6 Mon Sep 17 00:00:00 2001 From: lishengzhao Date: Mon, 20 Apr 2015 14:57:03 +0800 Subject: [PATCH] Add more article; Add grant_type,scope remark --- README.md | 5 +++++ others/database/initial_data.ddl | 4 ++-- others/oauth_test.txt | 18 ++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3508fdd..bb0492f 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,11 @@ OAuth 2 开发人员指南(Spring security oauth2), 翻译OAuth 2 Developers Guide(spring security oauth2)

+
  • +

    + 理解OAuth 2.0, 介绍Oauth2很不错的文章 +

    +
  • diff --git a/others/database/initial_data.ddl b/others/database/initial_data.ddl index 44565aa..d399e46 100644 --- a/others/database/initial_data.ddl +++ b/others/database/initial_data.ddl @@ -15,8 +15,8 @@ web_server_redirect_uri,authorities, access_token_validity, refresh_token_validity, additional_information, create_time, archived, trusted) values ('unity-client','unity-resource', 'unity', 'read,write','password,authorization_code,refresh_token,implicit', -null,'ROLE_UNITY',null, +null,'ROLE_CLIENT',null, null,null, now(), 0, 0), ('mobile-client','mobile-resource', 'mobile', 'read,write','password,refresh_token', -null,'ROLE_MOBILE',null, +null,'ROLE_CLIENT',null, null,null, now(), 0, 0); diff --git a/others/oauth_test.txt b/others/oauth_test.txt index ca09eeb..d258903 100644 --- a/others/oauth_test.txt +++ b/others/oauth_test.txt @@ -25,3 +25,21 @@ http://localhost:8080/unity/dashboard.htm?access_token=3420d0e0-ed77-45e1-8370-2 刷新access_token [GET] http://localhost:8080/oauth/token?client_id=mobile-client&client_secret=mobile&grant_type=refresh_token&refresh_token=b36f4978-a172-4aa8-af89-60f58abe3ba1 + + + +------------------------------------------------------------------------------------------------ +grant_type(授权方式) +1.authorization_code 授权码模式(即先登录获取code,再获取token) +2.password 密码模式(将用户名,密码传过去,直接获取token) +3.refresh_token 刷新token +4.implicit 简化模式(获取URL Hash传递token) +5.client_credentials 客户端模式(无用户,用户向客户端注册,然后客户端以自己的名义向'服务端'获取资源) + + +scope +1.read +2.write +3.trust + +