GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - junjin-lee/spring-restful-authorization: 这个 Demo 用于演示如何在 RESTful 下使用自定义 Token 保持客户端登录状态,依靠 Spring 的拦截器和解析器完成权限验证及登录用户注入,并使用 Redis 存储 Token。

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

7 Commits
7 Commits

Folders and files

NameName
Last commit message
Last commit date
src/main
src/main
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

###简介

关于Demo的介绍可以参考RESTful登录设计(基于Spring及Redis的Token鉴权)

###演示方式

  1. 下载该项目并修改application.properties文件,将MySQL和Redis的信息修改为自己的配置
  2. 打开init.sql文件,将其中的sql语句在MySQL中运行
  3. 通过mvn spring-boot:run启动项目,如果日志输出Started Application in 8.112 seconds (JVM running for 14.491)说明启动成功
  4. 浏览器打开localhost:8080,可以看到swagger-ui的主页
  5. 演示登录:在该页面打开POST tokens/,在username项输入admin、password项输入password,点击Try it out!,查看返回结果得到userId和token
  6. 演示退出登录:在该页面打开DELETE tokens/,在authorization中填写用userId和token以"_"拼接得到的字符串,点击Try it out!,如果返回码为200则成功。重复一次操作,返回码将变为401

###可能会遇到的问题:

java.lang.ClassNotFoundException: org.jboss.jandex.IndexView

原因是缺少org.jboss:jandex:1.1.0Final依赖,可能需要您手动在pom.xml中依赖中添加以下内容:

<dependency>
    <groupId>org.jboss</groupId>
    <artifactId>jandex</artifactId>
    <version>1.1.0.Final</version>
</dependency>

感谢@yrain的反馈!

###其他

如果这个Demo的功能刚好可以满足你的需求,在这里推荐我根据其封装的库:Spring Authorization Manager,希望能帮助你完成API服务端的身份验证功能。

About

这个 Demo 用于演示如何在 RESTful 下使用自定义 Token 保持客户端登录状态,依靠 Spring 的拦截器和解析器完成权限验证及登录用户注入,并使用 Redis 存储 Token。

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.