Add context path: spring-oauth-server

0.3
mkk 10 years ago
parent a915ac1ad9
commit bdd5f16295

@ -1,26 +1,26 @@
方式1:基于浏览器 (访问时后跳到登录页面,登录成功后跳转到redirect_uri指定的地址) [GET] 方式1:基于浏览器 (访问时后跳到登录页面,登录成功后跳转到redirect_uri指定的地址) [GET]
说明:只能使用admin或unity 账号登录才能有权限访问,若使用mobile账号登录将返回Access is denied 说明:只能使用admin或unity 账号登录才能有权限访问,若使用mobile账号登录将返回Access is denied
http://localhost:8080/oauth/authorize?client_id=unity-client&redirect_uri=http%3a%2f%2flocalhost%3a8080%2funity%2fdashboard.htm&response_type=code&scope=read http://localhost:8080/spring-oauth-server/oauth/authorize?client_id=unity-client&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2funity%2fdashboard.htm&response_type=code&scope=read
说明: 由于mobile-client只支持password,refresh_token, 所以不管用哪个账号登录后都将返回Illegal action 说明: 由于mobile-client只支持password,refresh_token, 所以不管用哪个账号登录后都将返回Illegal action
http://localhost:8080/oauth/authorize?client_id=mobile-client&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fmobile%2fdashboard.htm&response_type=code&scope=read http://localhost:8080/spring-oauth-server/oauth/authorize?client_id=mobile-client&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2fm%2fdashboard.htm&response_type=code&scope=read
响应的URL如: 响应的URL如:
http://localhost:8080/unity/dashboard.htm?code=zLl170 http://localhost:8080/spring-oauth-server/unity/dashboard.htm?code=zLl170
通过code换取access_token [GET] 通过code换取access_token [GET]
http://localhost:8080/oauth/token?client_id=unity-client&client_secret=unity&grant_type=authorization_code&code=zLl170&redirect_uri=http%3a%2f%2flocalhost%3a8080%2funity%2fdashboard.htm http://localhost:8080/spring-oauth-server/oauth/token?client_id=unity-client&client_secret=unity&grant_type=authorization_code&code=zLl170&redirect_uri=http%3a%2f%2flocalhost%3a8080%2fspring-oauth-server%2funity%2fdashboard.htm
方式2:基于客户端 (注意参数中的username,password,对应用户的账号,密码) [GET] 方式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 http://localhost:8080/spring-oauth-server/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 说明:由于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 http://localhost:8080/spring-oauth-server/oauth/token?client_id=unity-client&client_secret=unity&grant_type=password&scope=read,write&username=mobile&password=mobile
@ -29,14 +29,17 @@ http://localhost:8080/oauth/token?client_id=unity-client&client_secret=unity&gra
获取access_token后访问资源 [GET] 获取access_token后访问资源 [GET]
http://localhost:8080/unity/dashboard.htm?access_token=3420d0e0-ed77-45e1-8370-2b55af0a62e8 http://localhost:8080/spring-oauth-server/unity/dashboard.htm?access_token=3420d0e0-ed77-45e1-8370-2b55af0a62e8
刷新access_token [GET] 刷新access_token [GET]
http://localhost:8080/oauth/token?client_id=mobile-client&client_secret=mobile&grant_type=refresh_token&refresh_token=b36f4978-a172-4aa8-af89-60f58abe3ba1 http://localhost:8080/spring-oauth-server/oauth/token?client_id=mobile-client&client_secret=mobile&grant_type=refresh_token&refresh_token=b36f4978-a172-4aa8-af89-60f58abe3ba1
更多的测试请访问
http://git.oschina.net/mkk/spring-oauth-client
------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------
grant_type(授权方式) grant_type(授权方式)
@ -60,12 +63,12 @@ Use it get resource-server resources after auth successful. will use it in <spri
(retrieve current logged user information) (retrieve current logged user information)
[ROLE_UNITY] [ROLE_UNITY]
http://localhost:8080/unity/user_info?access_token=b03b99a1-f128-4d6e-b9d3-38a0ebcab5ef http://localhost:8080/spring-oauth-server/unity/user_info?access_token=b03b99a1-f128-4d6e-b9d3-38a0ebcab5ef
Response JSON Response JSON
{"archived":false,"email":"unity@wdcy.cc","guid":"55b713df1c6f423e842ad68668523c49","phone":"","privileges":["UNITY"],"username":"unity"} {"archived":false,"email":"unity@wdcy.cc","guid":"55b713df1c6f423e842ad68668523c49","phone":"","privileges":["UNITY"],"username":"unity"}
[ROLE_MOBILE] [ROLE_MOBILE]
http://localhost:8080/m/user_info?access_token=20837fa5-a0a1-4c76-9083-1f0e47ca0208 http://localhost:8080/spring-oauth-server/m/user_info?access_token=20837fa5-a0a1-4c76-9083-1f0e47ca0208
Response JSON Response JSON
{"archived":false,"email":"mobile@wdcy.cc","guid":"612025cb3f964a64a48bbdf77e53c2c1","phone":"","privileges":["MOBILE"],"username":"mobile"} {"archived":false,"email":"mobile@wdcy.cc","guid":"612025cb3f964a64a48bbdf77e53c2c1","phone":"","privileges":["MOBILE"],"username":"mobile"}

Loading…
Cancel
Save