Giter Site home page Giter Site logo

guolf / blossom-tool Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.71 MB

blossom-tool 是一个基于 Spring Boot 2 & Spring Cloud Finchley ,封装组合大量组件,用于快速构建中大型API、RESTful API项目的核心包。

License: GNU Lesser General Public License v3.0

Java 99.95% Lua 0.05%
springboot springcloud

blossom-tool's Introduction

简介

blossom-tool 是一个基于 Spring Boot 2 & Spring Cloud Finchley ,封装组合大量组件,用于快速构建中大型API、RESTful API项目的核心包。

工程结构

blossom-tool
├── blossom-core-boot -- 业务包综合模块
├── blossom-core-launch -- 基础启动模块
├── blossom-core-log -- 日志封装模块 
├── blossom-core-mybatis -- mybatis拓展封装模块 
├── blossom-core-secure -- 安全模块 
├── blossom-core-swagger -- swagger拓展封装模块 
└── blossom-core-tool -- 工具包模块 
	 

扩展 DefaultWebSessionManager,重写getSessionId方法

/** 
 * 获取session id
 * 前后端分离将从请求头中获取jsesssionid
 */
@Override
protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
	// 从请求头中获取token
	String token = WebUtils.toHttp(request).getHeader("Authorization");
	// 判断是否有值
	if (StringUtils.isNoneBlank(token)) {
		// 设置当前session状态
		request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_SOURCE, "url"); 
		request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID, token);  
		request.setAttribute(ShiroHttpServletRequest.REFERENCED_SESSION_ID_IS_VALID, Boolean.TRUE);  
		return token;
	}
	// 若header获取不到token则尝试从cookie中获取
	return super.getSessionId(request, response);
}


mvn versions:set -DnewVersion=2.2.4-SNAPSHOT

mvn versions:commit 

blossom-tool's People

Contributors

guolf avatar dependabot[bot] avatar

Watchers

 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.