Giter Site home page Giter Site logo

spring-boot-jwt-sample's Introduction

spring-boot-jwt-sample

spring boot整合jwt完成接口授权认证

1、注册用户(POST)

http://localhost:8081/api/v1.0/register

{
  "id": 1,
  "userName": "admin",
  "loginName": "admin",
  "password": "admin",
  "roles": "admin",
  "email": "[email protected]",
  "location": "xi'an",
  "signature": "admin",
  "createAt": "2018/5/30 10:06",
  "updateAt": "2018/5/30 10:06"
}

2、获取token(POST)

http://localhost:8081/api/v1.0/auth/token

{
  "userName": "admin",
  "loginName": "admin",
  "password": "admin"
}

3、请求接口(GET)

http://localhost:8081/api/v1.0/users/current

在请求头中添加第二步操作生成的jwt token

Header中添加Authorization其值为上一步生成的token信息如:Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImp0aSI6IjEiLCJyb2xlcyI6InVzZXIiLCJhdWQiOiJ3ZWIiLCJpYXQiOjE1Mjc2NDYxNjUsImlzcyI6ImFkbWluIiwiZXhwIjoxNTI3NzMyNTY1fQ.5kglv2hGTfmJ9PW61BFiak09NFW2aHRckP3GUdpkPe8W3K7psc0QCVOp7CNbfIB1LEC-JixX1RQCA6ymWyupIw

spring-boot-jwt-sample's People

Contributors

ameizi 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.