109 升级 spring-security-oauth2 的版本到 2.0.6以上, 目前是1.0.5

113 	Upgrade spring, spring security version to > 4.0
version: 0.4-beta
0.4-beta
Li Shengzhao 2015-11-09 15:38:58 +08:00
parent efff49afbe
commit 0dd9f8f057
3 changed files with 59 additions and 24 deletions

View File

@ -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;
}

View File

@ -73,8 +73,7 @@
<form:select path="scope" id="scope" cssClass="form-control">
<form:option value="read">read</form:option>
<form:option value="write">write</form:option>
<form:option value="trust">trust</form:option>
<form:option value="read,write">read,write</form:option>
<form:option value="read,write">read write</form:option>
</form:select>
<p class="help-block">scope必须选择</p>

View File

@ -41,18 +41,25 @@
<a href="${contextPath}/oauth/authorize?client_id={{clientId}}&redirect_uri={{redirectUri}}&response_type=code&scope={{scope}}"
target="_blank">
/oauth/authorize?client_id={{clientId}}&redirect_uri={{redirectUri}}&response_type=code&scope={{scope}}</a>
<span class="label label-info">GET</span>
</p>
</li>
<li>
<p>
<code>用 'code' 换取 'access_token'</code>
<br/>
输入第一步获取的code: <input type="text" name="code" value="" ng-model="code"
required="required"/>
<br/>
<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}"
target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}</a>
</p>
<code>用 'code' 换取 'access_token'</code>
<br/>
输入第一步获取的code: <input type="text" name="code" value="" ng-model="code"
required="required"/>
<br/>
<form action="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}"
method="post" target="_blank">
<%--<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}"--%>
<%--target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}</a>--%>
<button class="btn btn-link" type="submit">
/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=authorization_code&code={{code}}&redirect_uri={{redirectUri}}
</button>
<span class="label label-warning">POST</span>
</form>
</li>
</ol>
</div>
@ -68,10 +75,17 @@
<br/>
password: <input type="text" required="required" ng-model="password"/>
<p>
<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}"
target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}</a>
</p>
<br/>
<form action="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}"
method="post" target="_blank">
<%--<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}"--%>
<%--target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}</a>--%>
<button class="btn btn-link" type="submit">
/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=password&scope={{scope}}&username={{username}}&password={{password}}
</button>
<span class="label label-warning">POST</span>
</form>
</div>
</div>
</c:if>
@ -87,6 +101,7 @@
<p>
<a href="${contextPath}/oauth/authorize?client_id={{clientId}}&client_secret={{clientSecret}}&response_type=token&scope={{scope}}&redirect_uri={{implicitRedirectUri}}"
>/oauth/authorize?client_id={{clientId}}&client_secret={{clientSecret}}&response_type=token&scope={{scope}}&redirect_uri={{implicitRedirectUri}}</a>
<span class="label label-info">GET</span>
</p>
</div>
</div>
@ -98,10 +113,16 @@
<div class="panel-body">
<p class="text-muted">点击链接地址即可测试</p>
<p>
<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=client_credentials&scope={{scope}}"
target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=client_credentials&scope={{scope}}</a>
</p>
<form action="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=client_credentials&scope={{scope}}"
method="post" target="_blank">
<%--<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=client_credentials&scope={{scope}}"--%>
<%--target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=client_credentials&scope={{scope}}</a>--%>
<button class="btn btn-link" type="submit">
/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=client_credentials&scope={{scope}}
</button>
<span class="label label-warning">POST</span>
</form>
</div>
</div>
</c:if>
@ -113,10 +134,17 @@
<p class="text-muted">输入refresh_token 后点击链接地址.</p>
refresh_token: <input type="text" ng-model="refreshToken" required="required" size="70"/>
<p>
<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}"
target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}</a>
</p>
<br/>
<form action="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}"
method="post" target="_blank">
<%--<a href="${contextPath}/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}"--%>
<%--target="_blank">/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}</a>--%>
<button class="btn btn-link" type="submit">
/oauth/token?client_id={{clientId}}&client_secret={{clientSecret}}&grant_type=refresh_token&refresh_token={{refreshToken}}
</button>
<span class="label label-warning">POST</span>
</form>
</div>
</div>
</c:if>
@ -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}";
<c:if test="${empty clientDetailsDto.webServerRedirectUri}" var="eptRedUri">
$scope.implicitRedirectUri = location.href;