Giter Club home page Giter Club logo

spring-boot-oauth-jwt's Introduction

Coverage Status Downloads

spring-boot-oauth-jwt

本项目基于Spring Security OAuth2 2.3.4.RELEASE实现了OAuth2以及JWT两个认证方式,启动服务时要做简单的基础工作 redis、mysql,在mysql中导入创建表,具体sql请查看field的sql.md。这里的common是用来配置redis,以及公共工具类的,必须有。

JWT

jwt项目有两个服务,分别是token发放的服务和资源服务 启动jwt项目 启动jwt-resource 没有token直接访问jwt-resource接口是无法访问的。 通过向JWT申请token访问即可访问 通Postman的访问方式在file文件夹下用户认证中心的文件,将该文件到入到psotman修改下端口即可。返回示例如下

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1Njg2OTkxNjUsInVzZXJfbmFtZSI6ImFkbWluIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9BRE1JTiIsIlJPTEVfVVNFUiJdLCJqdGkiOiJjMzZiNGVjMi0zYmI5LTRkZDgtYjcwMS1mMjg5NjZmZTU5YzIiLCJjbGllbnRfaWQiOiJjbGllbnQiLCJzY29wZSI6WyJhbGwiXX0.h9Psk4K8eJOCNbO6nYaL_36Li6Jfvc5mvhij7e3FT7M",
    "token_type": "bearer",
    "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiJhZG1pbiIsInNjb3BlIjpbImFsbCJdLCJhdGkiOiJjMzZiNGVjMi0zYmI5LTRkZDgtYjcwMS1mMjg5NjZmZTU5YzIiLCJleHAiOjE1NzEyODM5NjUsImF1dGhvcml0aWVzIjpbIlJPTEVfQURNSU4iLCJST0xFX1VTRVIiXSwianRpIjoiZGFmNmYzZmEtYTY4Zi00MzNiLWE4MDktOTNjNDZmZmQ2NTk2IiwiY2xpZW50X2lkIjoiY2xpZW50In0.s1sYy9_yoA_CDbLniIVzypqhF2rUQlHiEXlEZM4etg0",
    "expires_in": 7199,
    "scope": "all",
    "jti": "c36b4ec2-3bb9-4dd8-b701-f28966fe59c2"
}

访问资源服务器时添加请求头 key是Authorization value是Bearer “access_token”的值 即可访问

OAuth2

同JWT一样 详细说明博客地址

spring-boot-oauth-jwt's People

Contributors

livemylifesun avatar

Watchers

James Cloos avatar  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.