GithubHelp home page GithubHelp logo

dnydys / easyspringsecurity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from snoyff/easyspringsecurity

0.0 0.0 0.0 34 KB

SpringSecurity后端权限管理系统脚手架,权限部分逻辑已经搭建完毕,方便快速上手! --如果你想要一个能基于SpringSecurity实现用户到角色再到每一个请求都纳入权限管理范围的话,那么可以完全基于本脚手架进行开发,每一环节的扩展点都暴露出来且标有注释,适合有一定基础的人员理解并进行二次开发。 --技术点:SpringSecurity+jwt+redis+rbac权限模型

License: GNU Affero General Public License v3.0

Java 100.00%

easyspringsecurity's Introduction

导读

EasySpringSecurity项目为SpringSecurity+Jwt+Redis+MySQL+RBAC权限管理系统后端的脚手架,已经把各种扩展点暴露出来,能快速理解上手使用,学习成本低,权限可以精确到控制到用户的每一个请求,现权限逻辑部分功能已经实现,可以基于本脚手架进行二次开发权限系统后台。本脚手架适合一定基础的开发人员,懂得rbac权限模型已经相关Springboot,SpringSecurity,jwt等知识和概念。

前期准备

数据库准备:MySQL、Redis
MySQL==>创建dev库 账号:root 密码:root
Redis ===> 不设密码
执行dev.sql脚本。 表设计遵循rbac权限模型,即用户拥有的角色去获得相应角色拥有的权限,表有用户表,角色表,菜单表,以及两两的关系表。

运行示例

用户默认有 rootadmin 密码为123,其中root拥有/hello,/admin访问权限,admin只有/hello权限。
1.登录
使用PostMan Post 请求路径http://localhost:8080/login 参数为form表单:username:admin password:123 登录拿到 accessToken的值:accessTokenValue 输入图片说明
2.请求路径-权限成功 使用PostMan Post 请求路径http://localhost:8080/hello Headers设置为accessToken:accessTokenValue 输入图片说明
3.请求路径-权限不足 使用PostMan Post 请求路径http://localhost:8080/admin Headers设置为accessToken:accessTokenValue 输入图片说明

SpringSecurity说明

SpringSecurity其实不难,本质上就是一个个过滤器链,其实现步骤主要为认证鉴定两个主要步骤。
认证:认证用户是否合法
鉴定:鉴定用户请求资源是否合法
SpringSecurity过滤链顺序为:用户认证链-jwtToken认证链-用户鉴定链
用户认证链:用户是否存在,密码是否正确
jwtToken认证链:用户提交的token是否正确,否则请求失败
用户鉴定链:用户请求的资源是否合法,否则拦截提示权限不足

SpringSecurity额外

如果想入门SpringSecurity,推荐王松的深入浅出SpringSecurity书。

easyspringsecurity's People

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.