(143) - Add project API document
							parent
							
								
									c0b0cf4529
								
							
						
					
					
						commit
						d5d14a7938
					
				|  | @ -0,0 +1,239 @@ | |||
| <!DOCTYPE html> | ||||
| <html> | ||||
| <head lang="en"> | ||||
|     <meta charset="UTF-8"/> | ||||
|     <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> | ||||
|     <link href="bootstrap.min.css" rel="stylesheet"/> | ||||
|     <title>spring-oauth-server API</title> | ||||
| </head> | ||||
| <body class="container"> | ||||
| <h2 class="page-header">spring-oauth-server | ||||
|     <small>V-0.5</small> | ||||
| </h2> | ||||
| 
 | ||||
| <div class="alert alert-info"> | ||||
|     <strong>说明</strong>: 本文档用于描述spring-oauth-server对外开发的接口(API)使用, 所有标记 | ||||
|     <small class="badge">public</small> | ||||
|     的API都是公开的, 其他的API则需要获取 | ||||
|     <mark>access_token</mark> | ||||
|     后可调用 | ||||
| </div> | ||||
| 
 | ||||
| <div class="row"> | ||||
|     <div class="col-md-3"> | ||||
|         <ul class="list-group"> | ||||
|             <li class="list-group-item"><a href="#getAccessTokenPassword">获取access_token (grant_type=password)</a></li> | ||||
|             <li class="list-group-item"><a href="#getTokenAuthCode">获取access_token (grant_type=authorization_code)</a> | ||||
|             </li> | ||||
|             <li class="list-group-item"><a href="#getTokenCred">获取access_token (grant_type=client_credentials)</a></li> | ||||
|             <li class="list-group-item"><a href="#getTokenRest">获取access_token (Restful API)</a></li> | ||||
|             <li class="list-group-item"><a href="#refreshToken">刷新access_token (grant_type=refresh_token)</a></li> | ||||
|             <li class="list-group-item"><a href="#">获取当前用户信息 (Unity)</a></li> | ||||
|             <li class="list-group-item"><a href="#">获取当前用户信息 (Mobile)</a></li> | ||||
|         </ul> | ||||
|     </div> | ||||
|     <div class="col-md-9"> | ||||
| 
 | ||||
|         <div class="well well-sm" id="getAccessTokenPassword"> | ||||
|             <h3>获取access_token (grant_type=password) | ||||
|                 <small class="badge">public</small> | ||||
|             </h3> | ||||
| 
 | ||||
|             <p class="text-muted">使用grant_type=password方式来获取access_token</p> | ||||
| 
 | ||||
|             <ul class="list-group"> | ||||
|                 <li class="list-group-item"> | ||||
|                     <p> | ||||
|                         请求URI: <code>/oauth/token</code> <span | ||||
|                             class="label label-warning">POST</span> | ||||
|                     </p> | ||||
| 
 | ||||
|                     <div> | ||||
|                         请求参数说明: | ||||
|                         <table class="table table-bordered"> | ||||
|                             <thead> | ||||
|                             <tr> | ||||
|                                 <th>参数名</th> | ||||
|                                 <th>参数值</th> | ||||
|                                 <th>必须?</th> | ||||
|                                 <th>备注</th> | ||||
|                             </tr> | ||||
|                             </thead> | ||||
|                             <tbody> | ||||
|                             <tr> | ||||
|                                 <td>client_id</td> | ||||
|                                 <td>{client_id}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td></td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>client_secret</td> | ||||
|                                 <td>{client_secret}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td></td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>grant_type</td> | ||||
|                                 <td>password</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td>固定值</td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>scope</td> | ||||
|                                 <td>{scope}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td>read or write</td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>username</td> | ||||
|                                 <td>{username}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td>用户名</td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>password</td> | ||||
|                                 <td>{password}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td>用户密码</td> | ||||
|                             </tr> | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                         请求示例: | ||||
|                         <p> | ||||
|                             <code>http://localhost:8080/spring-oauth-server/oauth/token?client_id=6361b08fdea6400f93b2eccda8936b32&client_secret=i4KXewMI0u6i8CFEZo10mB2rGzQRXrIv&grant_type=password&scope=read&username=mobile&password=mobile</code> | ||||
|                         </p> | ||||
| 
 | ||||
|                     </div> | ||||
|                     <br/> | ||||
| 
 | ||||
|                     <strong>响应</strong> | ||||
| 
 | ||||
|                     <ul class="list-group"> | ||||
|                         <li class="list-group-item"> | ||||
|                             <p> | ||||
|                                 正常 [200]<br/> | ||||
|                                 <mark> | ||||
|                                     {"access_token":"1f60abaf-6c3f-45a8-a574-bbbe6f76083f","token_type":"bearer","expires_in":41769,"scope":"read"} | ||||
|                                 </mark> | ||||
|                             </p> | ||||
|                         </li> | ||||
|                         <li class="list-group-item"> | ||||
|                             <p> | ||||
|                                 异常 [401]<br/> | ||||
|                                 <mark> | ||||
|                                     <oauth><error_description>Bad client credentials</error_description><error>invalid_client</error></oauth> | ||||
|                                 </mark> | ||||
|                             </p> | ||||
|                         </li> | ||||
|                     </ul> | ||||
|                 </li> | ||||
|             </ul> | ||||
|         </div> | ||||
| 
 | ||||
|         <div class="well well-sm" id="getTokenAuthCode"> | ||||
|             <h3>获取access_token (grant_type=authorization_code) | ||||
|                 <small class="badge">public</small> | ||||
|             </h3> | ||||
| 
 | ||||
|             <p class="text-muted">使用grant_type=authorization_code 方式来获取access_token, 需要先获取code</p> | ||||
| 
 | ||||
|             <ul class="list-group"> | ||||
|                 <li class="list-group-item"> | ||||
|                     <p> | ||||
|                         请求URI: <code>/oauth/token</code> <span | ||||
|                             class="label label-warning">POST</span> | ||||
|                     </p> | ||||
| 
 | ||||
|                     <div> | ||||
|                         请求参数说明: | ||||
|                         <table class="table table-bordered"> | ||||
|                             <thead> | ||||
|                             <tr> | ||||
|                                 <th>参数名</th> | ||||
|                                 <th>参数值</th> | ||||
|                                 <th>必须?</th> | ||||
|                                 <th>备注</th> | ||||
|                             </tr> | ||||
|                             </thead> | ||||
|                             <tbody> | ||||
|                             <tr> | ||||
|                                 <td>client_id</td> | ||||
|                                 <td>{client_id}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td></td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>client_secret</td> | ||||
|                                 <td>{client_secret}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td></td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>grant_type</td> | ||||
|                                 <td>authorization_code</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td>固定值</td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>code</td> | ||||
|                                 <td>{code}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td></td> | ||||
|                             </tr> | ||||
|                             <tr> | ||||
|                                 <td>redirect_uri</td> | ||||
|                                 <td>{redirect_uri}</td> | ||||
|                                 <td>是</td> | ||||
|                                 <td></td> | ||||
|                             </tr> | ||||
|                             </tbody> | ||||
|                         </table> | ||||
|                         请求示例: | ||||
|                         <p> | ||||
|                             <code>http://localhost:8080/spring-oauth-server/oauth/token?client_id=unity-client&client_secret=unity&grant_type=authorization_code&code=[code]&redirect_uri=[redirect_uri]</code> | ||||
|                         </p> | ||||
| 
 | ||||
|                     </div> | ||||
|                     <br/> | ||||
| 
 | ||||
|                     <strong>响应</strong> | ||||
| 
 | ||||
|                     <ul class="list-group"> | ||||
|                         <li class="list-group-item"> | ||||
|                             <p> | ||||
|                                 正常 [200]<br/> | ||||
|                                 <mark> | ||||
|                                     {"access_token":"2c612eb7-a22b-45f0-8b2e-cd6f9e366772","token_type":"bearer","refresh_token":"6c984bdc-01c7-486f-93bf-5637990d8a37","expires_in":43199,"scope":"read | ||||
|                                     write"} | ||||
|                                 </mark> | ||||
|                             </p> | ||||
|                         </li> | ||||
|                         <li class="list-group-item"> | ||||
|                             <p> | ||||
|                                 异常 [401]<br/> | ||||
|                                 <mark> | ||||
|                                     {"error":"invalid_grant","error_description":"Invalid authorization code: vzmIh1"} | ||||
|                                 </mark> | ||||
|                             </p> | ||||
|                         </li> | ||||
|                     </ul> | ||||
|                 </li> | ||||
|             </ul> | ||||
|         </div> | ||||
| 
 | ||||
|     </div> | ||||
| </div> | ||||
| 
 | ||||
| 
 | ||||
| <div class="row"> | ||||
|     <div class="col-md-12"> | ||||
|         <hr/> | ||||
|         <p class="text-center text-muted"> | ||||
|             © 2013 - 2016 | ||||
|             <a href="mailto:sz@monkeyk.com">sz@monkeyk.com</a> from <a | ||||
|                 href="http://git.oschina.net/shengzhao/spring-oauth-server" target="_blank">spring-oauth-server</a> | ||||
|         </p> | ||||
|     </div> | ||||
| </div> | ||||
| </body> | ||||
| </html> | ||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 1.1 KiB | 
|  | @ -13,7 +13,9 @@ | |||
| 
 | ||||
| </head> | ||||
| <body> | ||||
| <h2>Spring Security&Oauth2 is work!</h2> | ||||
| <h2>Spring Security&Oauth2 | ||||
|     <small class="badge" title="Version">0.5</small> | ||||
| </h2> | ||||
| 
 | ||||
| <p> | ||||
|     <a href="${contextPath}/login.jsp">Login</a> | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 LSZ
						LSZ