Add more description; default client_id, client_secret generate
parent
5d8ce06f3b
commit
c0b0cf4529
|
@ -1,6 +1,7 @@
|
|||
package com.monkeyk.sos.domain.dto;
|
||||
|
||||
import com.monkeyk.sos.domain.oauth.OauthClientDetails;
|
||||
import com.monkeyk.sos.domain.shared.GuidGenerator;
|
||||
import com.monkeyk.sos.infrastructure.DateUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
|
@ -14,13 +15,14 @@ import java.util.List;
|
|||
public class OauthClientDetailsDto implements Serializable {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -690401014127462329L;
|
||||
private String createTime;
|
||||
private boolean archived;
|
||||
|
||||
private String clientId;
|
||||
private String clientId = GuidGenerator.generate();
|
||||
private String resourceIds;
|
||||
|
||||
private String clientSecret;
|
||||
private String clientSecret = GuidGenerator.generateClientSecret();
|
||||
|
||||
private String scope;
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.monkeyk.sos.domain.shared;
|
||||
|
||||
import org.springframework.security.oauth2.common.util.RandomValueStringGenerator;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -7,6 +9,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public abstract class GuidGenerator {
|
||||
|
||||
private static RandomValueStringGenerator defaultClientSecretGenerator = new RandomValueStringGenerator(32);
|
||||
|
||||
/**
|
||||
* private constructor
|
||||
|
@ -17,4 +20,9 @@ public abstract class GuidGenerator {
|
|||
public static String generate() {
|
||||
return UUID.randomUUID().toString().replaceAll("-", "");
|
||||
}
|
||||
|
||||
|
||||
public static String generateClientSecret() {
|
||||
return defaultClientSecretGenerator.generate();
|
||||
}
|
||||
}
|
|
@ -20,14 +20,14 @@
|
|||
<h2>注册client</h2>
|
||||
|
||||
<div ng-app>
|
||||
<p class="help-block">
|
||||
若对Oauth的<code>client_details</code>中的属性及作用不清楚,
|
||||
建议你先查看项目中的<code>db_table_description.html</code>文件(位于others目录)中对表<code>oauth_client_details</code>的说明,
|
||||
或在线访问<a href="http://andaily.com/spring-oauth-server/db_table_description.html" target="_blank">db_table_description.html</a>;
|
||||
因为注册client实际上是向该表中按不同的条件添加数据.
|
||||
</p>
|
||||
<p class="help-block">
|
||||
若对Oauth的<code>client_details</code>中的属性及作用不清楚,
|
||||
建议你先查看项目中的<code>db_table_description.html</code>文件(位于others目录)中对表<code>oauth_client_details</code>的说明,
|
||||
或在线访问<a href="http://andaily.com/spring-oauth-server/db_table_description.html" target="_blank">db_table_description.html</a>;
|
||||
因为注册client实际上是向该表中按不同的条件添加数据.
|
||||
</p>
|
||||
|
||||
<div ng-controller="RegisterClientCtrl">
|
||||
<div ng-controller="RegisterClientCtrl">
|
||||
<form:form commandName="formDto" cssClass="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="clientId" class="col-sm-2 control-label">client_id<em class="text-danger">*</em></label>
|
||||
|
@ -110,7 +110,9 @@
|
|||
refresh_token
|
||||
</label>
|
||||
|
||||
<p class="help-block">至少勾选一项grant_type(s), 且不能只单独勾选<code>refresh_token</code></p>
|
||||
<p class="help-block">至少勾选一项grant_type(s), 且不能只单独勾选<code>refresh_token</code>, 若需更多帮助请访问 <a
|
||||
href="https://andaily.com/blog/?p=103"
|
||||
target="_blank">https://andaily.com/blog/?p=103</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -32,13 +32,17 @@
|
|||
<li>
|
||||
<p>
|
||||
菜单 Unity 与 Mobile 需要Oauth 验证后才能访问(即受保护的resource); <br/>
|
||||
Unity 需要 [ROLE_UNITY] 权限, Mobile 需要 [ROLE_MOBILE] 权限.
|
||||
Unity 需要 [ROLE_UNITY] 权限(resourceId:
|
||||
<mark>unity-resource</mark>
|
||||
), Mobile 需要 [ROLE_MOBILE] 权限(resourceId:
|
||||
<mark>mobile-resource</mark>
|
||||
).
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
在使用之前, 建议先了解OAuth2支持的5类<code>grant_type</code>, 请访问 <a href="https://andaily.com/blog/?p=103"
|
||||
target="_blank">https://andaily.com/blog/?p=103</a>
|
||||
target="_blank">https://andaily.com/blog/?p=103</a>
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
|
|
Loading…
Reference in New Issue