From 0dd9f8f057249eae6297bc28b6c2314f82e8a223 Mon Sep 17 00:00:00 2001
From: Li Shengzhao
Date: Mon, 9 Nov 2015 15:38:58 +0800
Subject: [PATCH] =?UTF-8?q?109=20=09=E5=8D=87=E7=BA=A7=20spring-security-o?=
=?UTF-8?q?auth2=20=E7=9A=84=E7=89=88=E6=9C=AC=E5=88=B0=202.0.6=E4=BB=A5?=
=?UTF-8?q?=E4=B8=8A,=20=E7=9B=AE=E5=89=8D=E6=98=AF1.0.5=20113=20=09Upgrad?=
=?UTF-8?q?e=20spring,=20spring=20security=20version=20to=20>=204.0=20vers?=
=?UTF-8?q?ion:=200.4-beta?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../domain/dto/OauthClientDetailsDto.java | 8 +++
.../jsp/clientdetails/register_client.jsp | 3 +-
.../WEB-INF/jsp/clientdetails/test_client.jsp | 72 +++++++++++++------
3 files changed, 59 insertions(+), 24 deletions(-)
diff --git a/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java b/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java
index 7d3b84b..1815032 100644
--- a/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java
+++ b/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java
@@ -107,6 +107,14 @@ public class OauthClientDetailsDto implements Serializable {
return scope;
}
+
+ public String getScopeWithBlank() {
+ if (scope != null && scope.contains(",")) {
+ return scope.replaceAll(",", " ");
+ }
+ return scope;
+ }
+
public void setScope(String scope) {
this.scope = scope;
}
diff --git a/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp b/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp
index 53f3228..949f15e 100644
--- a/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp
+++ b/src/main/webapp/WEB-INF/jsp/clientdetails/register_client.jsp
@@ -73,8 +73,7 @@
read
write
- trust
- read,write
+ read write
scope必须选择
diff --git a/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp b/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp
index 9e030ba..2aadfa1 100644
--- a/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp
+++ b/src/main/webapp/WEB-INF/jsp/clientdetails/test_client.jsp
@@ -41,18 +41,25 @@
/oauth/authorize?client_id={{clientId}}&redirect_uri={{redirectUri}}&response_type=code&scope={{scope}}
+ GET
-
- 用 'code' 换取 'access_token'
-
- 输入第一步获取的code:
-
- /oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}
-
+ 用 'code' 换取 'access_token'
+
+ 输入第一步获取的code:
+
+
+
@@ -68,10 +75,17 @@
password:
-
- /oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}
-
+
+
+
@@ -87,6 +101,7 @@
/oauth/authorize?client_id={{clientId}}&client_secret={{clientSecret}}&response_type=token&scope={{scope}}&redirect_uri={{implicitRedirectUri}}
+ GET
@@ -98,10 +113,16 @@
@@ -113,10 +134,17 @@
输入refresh_token 后点击链接地址.
refresh_token:
-
- /oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}
-
+
+
+
@@ -131,7 +159,7 @@
var TestClientCtrl = ["$scope", function ($scope) {
$scope.clientId = "${clientDetailsDto.clientId}";
$scope.clientSecret = "${clientDetailsDto.clientSecret}";
- $scope.scope = "${clientDetailsDto.scope}";
+ $scope.scope = "${clientDetailsDto.scopeWithBlank}";
$scope.implicitRedirectUri = location.href;