Code Monkey home page Code Monkey logo

spring-security-oauth2-learn's Introduction

spring-security-oauth2-learn

仓库说明

此项目用于学习Spring Security OAuth2,Demo使用的Api为5.2版本前的,现在提示已经废弃,ps:官方认为自己的授权服务器实现的太差,以后打算用第三方库 :happy:

后续有时间使用官方推荐第三方库还会再实现一遍

另外,本仓库均使用授权服务与资源服务分离的方式来编写demo,由于此二者放在同一服务时默认省了很多配置(资源服务器访问授权服务器进行校验token部分),对于后续应用会埋下许多坑,所以分离开来

基础演示demo功能说明

基础Demo均使用内存保存token,仅用于测试

  • authorization-code : 授权码模式

  • client-credentials : 客户端模式

  • implicit: 隐式模式(简化模式)

  • password: 密码模式

client端对接demo

  • authorization-code/authorization-code-client-resttemplate-jdbc : 使用RestTemplate和数据库实现的授权码模式手动对接客户端,token保存到数据库
  • uaa-interface-adapter-demo : 使用OAuth2提供的工具类,实现的客户端模式与密码模式的登录功能适配,也可以作为不显示使用/oauth/token端点的适配层,提升代码灵活性
  • client-credentials/client-credentials-client: 实现一个客户端,如果调用其它服务的请求头中没有登录标识,使用客户端模式获取token,调用其它服务

JWT

使用rsa非对称加密,对称加密请参考本目录之前的提交

  • jwt-authorization-server : 添加JWT实现token的授权服务器,这里开启了授权码与密码模式,支持refresh_token
  • jwt-resource-server:资源服务器,本地校验jwt token,解析出用户信息

使用Redis存储token

  • redis-token-saved-authorization-server : 使用password与授权码模式,支持刷新token的授权服务器,token保存到redis中
  • redis-token-saved-resource-server : 使用redis校验token的资源服务器

spring-security-oauth2-learn's People

Contributors

hellxz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.