1 Star 0 Fork 0

gcyit / spring-oauth-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 4.98 KB
一键复制 编辑 原始数据 按行查看 历史
gcyit 提交于 2015-11-20 18:19 . 初始提交

#spring-oauth-client

spring-oauth-client depend on spring-oauth-server, it is the oauth2 client demos.

项目用Maven管理

使用的技术与版本号

  1. JDK (1.7.0_40)
  2. Spring (4.1.6.RELEASE)
  3. Spring MVC (4.1.6.RELEASE)
  4. HttpClient (4.3.5)
  5. json-lib (2.4)
  6. Log4j (1.2.14)
前端使用的技术与版本号
  1. Angular-JS (1.1.5)
  2. Bootstrap (3.3.4)

Oauth服务端项目请访问 spring-oauth-server

在线测试地址 https://andaily.com/spring-oauth-client/


如何使用?
前提: 在使用之前必须保证 spring-oauth-server 项目已正常运行.

  1. 项目是Maven管理的, 需要本地安装maven(开发用的maven版本号为3.1.0)
  2. 下载(或clone)项目到本地
  3. 修改spring-oauth-client.properties(位于src/main/resources目录)中的配置信息(主要包括与spring-oauth-server的连接地址)
  4. 将本地项目导入到IDE(如Intellij IDEA)中,配置Tomcat(或类似的servlet运行服务器), 并启动Tomcat(默认端口为8080) ,通过浏览器访问即可.
    注意将项目的 contextPath(根路径) 设置为 'spring-oauth-client'.
    所有的操作说明都在页面上体现.
    另: 也可通过maven package命令将项目编译为war文件(spring-oauth-client.war), 将war放在Tomcat中并启动(注意: 这种方式需要将spring-oauth-client.properties加入到classpath中并正确配置)

实现思路

spring-oauth-client 的实现没有使用开源项目 spring-security-oauth2 中提供的代码与配置, 如:<oauth:client id="oauth2ClientFilter" />

而是按照Oauth2协议支持的5类grant_type依次去实现.

  1. authorization_code -- 授权码模式(即先登录获取code,再获取token)
  2. password -- 密码模式(将用户名,密码传过去,直接获取token)
  3. client_credentials -- 客户端模式(无用户,用户向客户端注册,然后客户端以自己的名义向'服务端'获取资源)
  4. implicit -- 简化模式(在redirect_uri 的Hash传递token; Auth客户端运行在浏览器中,如JS,Flash)
  5. refresh_token -- 刷新access_token
</p>

项目的开发管理使用开源项目 andaily-developer.


项目日志

  1. 2015-03-17 项目创建

  2. 2015-06-02 V-0.1版本发布

  3. 2015-11-16 添加在线测试, 访问地址 https://andaily.com/spring-oauth-client/


参考资源
以下是在开发与学习过程中参考的Oauth资源,总结下来方便学习回顾.


与项目相关的技术文章请访问 http://andaily.com/blog/?cat=19 (不断更新与Oauth相关的文章)

问答与讨论
与项目相关的,与Oauth相关的问题与回答,以及各类讨论请访问
http://andaily.com/blog/?dwqa-question_category=oauth


关注更多我的开源项目请访问 http://andaily.com/my_projects.html

若需更多的技术支持请联系 monkeyk@shengzhaoli.com


Expect your joining...
1
https://gitee.com/ycyit/spring-oauth-client.git
git@gitee.com:ycyit/spring-oauth-client.git
ycyit
spring-oauth-client
spring-oauth-client
master

搜索帮助