From 79a99da4ed5c660aa889d75111ba3a3586042c2a Mon Sep 17 00:00:00 2001 From: lishengzhao Date: Fri, 15 May 2015 16:23:00 +0800 Subject: [PATCH] 00007 Security implement different privilege --- others/oauth_test.txt | 3 +++ src/main/webapp/index.jsp | 17 +++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/others/oauth_test.txt b/others/oauth_test.txt index 9ef0a96..5971f8f 100644 --- a/others/oauth_test.txt +++ b/others/oauth_test.txt @@ -19,6 +19,9 @@ http://localhost:8080/oauth/token?client_id=unity-client&client_secret=unity&gra 方式2:基于客户端 (注意参数中的username,password,对应用户的账号,密码) [GET] http://localhost:8080/oauth/token?client_id=mobile-client&client_secret=mobile&grant_type=password&scope=read,write&username=mobile&password=mobile +说明:由于unity-client不支持password,所以若用unity-client通过password方式去授权,将返回invalid_grant +http://localhost:8080/oauth/token?client_id=unity-client&client_secret=unity&grant_type=password&scope=read,write&username=mobile&password=mobile + 获取access_token响应的数据如: diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp index b0c92db..3d712d9 100644 --- a/src/main/webapp/index.jsp +++ b/src/main/webapp/index.jsp @@ -20,12 +20,21 @@ 操作说明:
  1. - 菜单 User 是不需要Oauth 验证即可访问的,
    - 但菜单 Unity 与 Mobile 需要Oauth 验证后才能访问. +

    + 菜单 User 是不需要Oauth 验证即可访问的(即公开的resource) +

  2. - 在项目的 others目录里有 oauth_test.txt文件, 里面有测试的URL地址(包括浏览器与客户端的), - 若想访问 Unity 与 Mobile, 则先用基于浏览器的测试URL 访问,等验证通过后即可访问. +

    + 菜单 Unity 与 Mobile 需要Oauth 验证后才能访问(即受保护的resource);
    + Unity 需要 [ROLE_UNITY] 权限, Mobile 需要 [ROLE_MOBILE] 权限. +

    +
  3. +
  4. +

    + 在项目的 others目录里有 oauth_test.txt文件, 里面有测试的URL地址(包括浏览器与客户端的),
    + 若想访问 Unity 与 Mobile, 则先用基于浏览器的测试URL 访问,等验证通过后即可访问(注意不同的账号对应的权限). +