Update documents
parent
11cc1d0036
commit
7349366f3b
|
@ -1,14 +1,13 @@
|
|||
|
||||
|
||||
使用的主要技术与版本号
|
||||
*Spring (3.1.1.RELEASE)
|
||||
*Spring Security (3.1.0.RELEASE)
|
||||
*MyBatis (3.2.1)
|
||||
*spring-security-oauth2 (1.0.5.RELEASE)
|
||||
*Spring (4.1.6.RELEASE)
|
||||
*Spring Security (4.0.1.RELEASE)
|
||||
*spring-security-oauth2 (2.0.7.RELEASE)
|
||||
|
||||
|
||||
如何使用?
|
||||
1.项目是Maven管理的, 需要本地安装maven(开发用的maven版本号为3.1.0), 还有MySql(开发用的mysql版本号为5.5)
|
||||
1.项目是Maven管理的, 需要本地安装maven(开发用的maven版本号为3.1.0), 还有MySql(开发用的mysql版本号为5.6)
|
||||
|
||||
2.下载(或clone)项目到本地
|
||||
|
||||
|
@ -17,7 +16,7 @@
|
|||
|
||||
4.修改spring-oauth-server.properties(位于src/resources目录)中的数据库连接信息(包括username, password等)
|
||||
|
||||
5.将本地项目导入到IDE(如Intellij IDEA)中,配置Tomcat(或类似的servelt运行服务器), 并启动Tomcat(默认端口为8080)
|
||||
5.将本地项目导入到IDE(如Intellij IDEA)中,配置Tomcat(或类似的servlet运行服务器), 并启动Tomcat(默认端口为8080)
|
||||
另: 也可通过maven package命令将项目编译为war文件(spring-oauth-server.war),
|
||||
将war放在Tomcat中并启动(注意: 这种方式需要将spring-oauth-server.properties加入到classpath中并正确配置数据库连接信息).
|
||||
|
||||
|
|
|
@ -12,11 +12,11 @@ http://localhost:8080/spring-oauth-server/oauth/authorize?client_id=mobile-clien
|
|||
响应的URL如:
|
||||
http://localhost:8080/spring-oauth-server/unity/dashboard.htm?code=zLl170
|
||||
|
||||
通过code换取access_token [GET]
|
||||
通过code换取access_token [POST]
|
||||
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
|
||||
|
||||
|
||||
方式2:基于客户端 (注意参数中的username,password,对应用户的账号,密码) [GET]
|
||||
方式2:基于客户端 (注意参数中的username,password,对应用户的账号,密码) [POST]
|
||||
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
|
||||
|
@ -33,7 +33,7 @@ http://localhost:8080/spring-oauth-server/unity/dashboard.htm?access_token=3420d
|
|||
|
||||
|
||||
|
||||
刷新access_token [GET]
|
||||
刷新access_token [POST]
|
||||
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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue