GithubHelp home page GithubHelp logo

liuzchao / spring-security-session-redis-user-details-service Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fengmiao/spring-security-session-redis-user-details-service

0.0 1.0 0.0 3.11 MB

Java Spring Security Session Redis Rest API 手机APP后端 后台管理 综合一体化方案

Home Page: https://blog.sectong.com

License: Apache License 2.0

Java 0.63% CSS 6.17% JavaScript 91.53% HTML 1.67%

spring-security-session-redis-user-details-service's Introduction

#Spring Security Session Redis UserDetails Rest API 手机APP后端 后台管理 综合一体化方案

##架构设计 Alt 架构设计 ##业务逻辑层次划分 业务逻辑层次划分 ##在线API参考手册 Alt 在线API参考手册 ##管理后台主页 Alt 管理后台主页 ##管理后台-用户管理 Alt 管理后台-用户管理 ##数据库管理后台-基于lightadmin lightadmin-database

##启动应用步骤: #####1、本地新建MySQL数据库demo,导入数据表(下面有create user table); #####2、本地启动redis服务器(默认redis存储token已关闭,可以在demo.session中去掉注释,来开启redis给功能); #####3、运行

mvn spring-boot:run
log出现:Tomcat started on port(s): 8080 (http),证明启动成功

##访问在线API文档: http://localhost:8080/debug/index.html 即可在线查看API手册和调试API。

##具体测试操作步骤 #####1、使用在线API注册用户: /api/create 接口; #####2、http://localhost:8080/ 测试“多重认证”(web form模拟web应用和httpBasic模拟客户端应用); #####3、http://localhost:8080/admin/ 登录访问图形管理界面(需要在authorities表中增加一条 第1步中创建的用户权限,比如:admin ROLE_ADMIN ); #####4、http://localhsot:8080/lightadmin/ 可GUI管理数据库;

##创建数据库 create user table:

CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(45) NOT NULL,
  `password` varchar(100) NOT NULL,
  `image` varchar(200) DEFAULT '',
  `enabled` varchar(45) NOT NULL DEFAULT '1',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username_UNIQUE` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;


CREATE TABLE `authorities` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(45) NOT NULL,
  `authority` varchar(45) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username_UNIQUE` (`username`,`authority`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;

##API保活访问采用cookie方式,APP客户端需要把cookie放在http header中发送到服务端,测试如下,SESSION换成你得到的cookie即可

curl http://localhost:8080/api/i/user/9 -H "Cookie:SESSION=5b55e933-7c68-4333-82e4-656d777d72a4"

spring-security-session-redis-user-details-service's People

Contributors

jiekechoo avatar

Watchers

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