springboot+shiro+jwt 兼容session和token

最近和别的软件集成项目,需要提供给别人接口来进行数据传输,发现给他token后并不能访问我的接口,拿postman试了下还真是不行。检查代码发现项目的shiro配置是通过session会话来校验信息的 ,我之前一直是前后端自己写,用浏览器来调试的程序所以没发现这个问题。
浏览器请求头的cookie带着JESSIONID是可以正常访问接口的
在这里插入图片描述

那要和别的项目集成,他那边又不是通过浏览器,咋办呢,我这边改造吧,兼容token和session不就行了,下面直接贴改造后的完整代码。

pom加依赖

		<dependency><groupId>org.crazycake</groupId><artifactId>shiro-redis</artifactId><version>2.4.2.1-RELEASE</version></dependency><dependency><groupId>org.apache.shiro</groupId><artifactId>shiro-all</artifactId><version>1.3.2</version></dependency><dependency><groupId>com.auth0</groupId><artifactId>java-jwt</artifactId><version>3.2.0</version></dependency>

1.JwtToken重写token类型

package com.mes.common.token;import com.mes.module.user.dto.SysUserDto;
import lombok.Data;
import org.apache.shiro.authc.HostAuthenticationToken;
import org.apache.shiro.authc.RememberMeAuthenticationToken;
import org.apache.shiro.authc.UsernamePasswordToken;@Data
public class JwtToken implements HostAuthenticationToken, RememberMeAuthenticationToken {private String token;private char[] password;private boolean rememberMe = false;private String host;public JwtToken(String token){this.token = token;}@Overridepublic String getHost() {return null;}@Overridepublic boolean isRememberMe() {return false;}@Overridepublic Object getPrincipal() {return token;}@Overridepublic Object getCredentials() {return token;}
}

2.自定义过滤器 JwtFilter

package com.mes.common.shiro;import com.alibaba.fastjson.JSON;
import com.auth0.jwt.interfaces.Claim;
import com.mes.common.token.JwtToken;
import com.mes.common.utils.JwtUtils;
import com.mes.common.utils.Result;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
import org.apache.shiro.web.util.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMethod;import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;/*** @Description 自定义过滤器* @Date 2021/8/18**/
public class JwtFilter extends AuthenticatingFilter {private static final Logger log = LoggerFactory.getLogger(JwtFilter.class);@Overrideprotected AuthenticationToken createToken(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {HttpServletRequest request = (HttpServletRequest) servletRequest;String token = request.getHeader("token");if (token == null){return null;}return new JwtToken(token);}/*** 拦截校验  没有登录的情况下会走此方法* @param servletRequest* @param servletResponse* @return* @throws Exception*/@Overrideprotected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {HttpServletRequest request = (HttpServletRequest) servletRequest;HttpServletResponse response = (HttpServletResponse) servletResponse;String token = request.getHeader("token");response.setContentType("application/json;charset=utf-8");response.setHeader("Access-Control-Allow-Credentials", "true");response.setHeader("Access-control-Allow-Origin", request.getHeader("Origin"));response.setHeader("Access-Control-Allow-Methods", "GET,PUT,DELETE,UPDATE,OPTIONS");response.setHeader("Access-Control-Allow-Headers", request.getHeader("Access-Control-Request-Headers"));Subject subject = getSubject(servletRequest,servletResponse);if (!subject.isAuthenticated()){// 未登录PrintWriter writer = response.getWriter();writer.print(JSON.toJSONString(new Result<>().setCode(402).setMsg("请先登录")));return false;}if (StringUtils.isEmpty(token)){PrintWriter writer = response.getWriter();writer.print(JSON.toJSONString(new Result<>().setCode(402).setMsg("请先登录")));return false;}else {// 校验jwttry {Map<String, Claim> claimMap = JwtUtils.verifyToken(token);} catch (Exception e) {e.printStackTrace();PrintWriter writer = response.getWriter();writer.write(JSON.toJSONString(new Result<>().setCode(402).setMsg("登录失效,请重新登录")));return false;}return executeLogin(servletRequest, servletResponse);}}@Overrideprotected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request, ServletResponse response) {HttpServletResponse httpServletResponse = (HttpServletResponse) response;Throwable throwable = e.getCause() == null ? e : e.getCause();Result result = new Result().err().setMsg(e.getMessage());String json = JSON.toJSONString(result);try {httpServletResponse.getWriter().print(json);} catch (IOException ioException) {}return false;}/*** 跨域支持* @param servletRequest* @param response* @return* @throws Exception*/@Overrideprotected boolean preHandle(ServletRequest servletRequest, ServletResponse response) throws Exception {HttpServletRequest httpRequest = WebUtils.toHttp(servletRequest);HttpServletResponse httpResponse = WebUtils.toHttp(response);if (httpRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {httpResponse.setHeader("Access-Control-Allow-Credentials", "true");httpResponse.setHeader("Access-control-Allow-Origin", httpRequest.getHeader("Origin"));httpResponse.setHeader("Access-Control-Allow-Methods", "GET,PUT,DELETE,UPDATE,OPTIONS");httpResponse.setHeader("Access-Control-Allow-Headers", httpRequest.getHeader("Access-Control-Request-Headers"));System.out.println(httpRequest.getHeader("Origin"));System.out.println(httpRequest.getMethod());System.out.println(httpRequest.getHeader("Access-Control-Request-Headers"));httpResponse.setStatus(HttpStatus.OK.value());return false;}HttpServletRequest request = (HttpServletRequest) servletRequest;String token = request.getHeader("token");if (token != null) {try {
//                Map<String, Claim> claimMap = JwtUtils.verifyToken(token);
//                String authToken = claimMap.get("token").asString();JwtToken jwtToken = new JwtToken(token);Subject subject = SecurityUtils.getSubject();subject.login(jwtToken);return true;} catch (Exception e) {e.printStackTrace();log.error("token失效,请重新登录");response.getWriter().print(JSON.toJSONString(new Result<>().setCode(402).setMsg("token失效,请重新登录")));}}return false;}/*    protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {HttpServletRequest httpRequest = WebUtils.toHttp(request);HttpServletResponse httpResponse = WebUtils.toHttp(response);if (httpRequest.getMethod().equals(RequestMethod.OPTIONS.name())) {httpResponse.setHeader("Access-Control-Allow-Credentials", "true");httpResponse.setHeader("Access-control-Allow-Origin", httpRequest.getHeader("Origin"));httpResponse.setHeader("Access-Control-Allow-Methods", "GET,PUT,DELETE,UPDATE,OPTIONS");httpResponse.setHeader("Access-Control-Allow-Headers", httpRequest.getHeader("Access-Control-Request-Headers"));System.out.println(httpRequest.getHeader("Origin"));System.out.println(httpRequest.getMethod());System.out.println(httpRequest.getHeader("Access-Control-Request-Headers"));httpResponse.setStatus(HttpStatus.OK.value());return false;}return super.preHandle(request, response);}*/}

3.配置过滤器 ShiroFilterRegisterConfig

package com.mes.common.config;import com.mes.common.shiro.JwtFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;/*** @Description TODO* @Date 2021/8/19**/
@Configuration
public class ShiroFilterRegisterConfig {@Beanpublic FilterRegistrationBean shiroLoginFilteRegistration(JwtFilter filter) {FilterRegistrationBean registration = new FilterRegistrationBean(filter);registration.setEnabled(false);return registration;}
}

4. shiroConfig

package com.mes.common.config;

import com.baomidou.mybatisplus.extension.api.R;
import com.mes.common.constant.ExpTime;
import com.mes.common.realm.MyRealm;
import com.mes.common.shiro.JwtFilter;
import com.mes.common.shiro.MyCredentialsMatcher;
import org.apache.shiro.session.mgt.SessionManager;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.crazycake.shiro.RedisCacheManager;
import org.crazycake.shiro.RedisManager;
import org.crazycake.shiro.RedisSessionDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.servlet.Filter;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;

/**

  • @Description shiro配置
  • @Date 2021/8/18
    **/
    @Configuration
    public class ShiroConfig {
    @Autowired
    private MyRealm myRealm;
    @Autowired
    private MyCredentialsMatcher myCredentialsMatcher;
    @Value(“ s p r i n g . r e d i s . h o s t " ) p r i v a t e S t r i n g r e d i s H o s t ; @ V a l u e ( " {spring.redis.host}") private String redisHost; @Value(" spring.redis.host")privateStringredisHost;@Value("{spring.redis.port}”)
    private Integer redisPort;
    @Value(“${spring.redis.timeout}”)
    private Integer redisTimeout;

// @Bean
// public DefaultWebSessionManager sessionManager(@Value(“${globalSessionTimeout:3600}”) long globalSessionTimeout, RedisManager c){
// DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
// sessionManager.setSessionValidationSchedulerEnabled(true);
// sessionManager.setSessionIdUrlRewritingEnabled(false);
// sessionManager.setSessionValidationInterval(globalSessionTimeout * 1000);
// sessionManager.setGlobalSessionTimeout(globalSessionTimeout * 1000);
// sessionManager.setSessionDAO(redisSessionDAO©);
// return sessionManager;
// }
// @ConfigurationProperties(prefix=“spring.redis”)
// @Bean
// public RedisManager redisManager() {
// return new RedisManager();
// }
// @Bean
// public RedisSessionDAO redisSessionDAO(RedisManager redisManager) {
// RedisSessionDAO redisSessionDAO = new RedisSessionDAO();
// redisSessionDAO.setRedisManager(redisManager);
// return redisSessionDAO;
// }

// @Bean
// public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator(){
//
// DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator=new DefaultAdvisorAutoProxyCreator();
// defaultAdvisorAutoProxyCreator.setUsePrefix(true);
//
// return defaultAdvisorAutoProxyCreator;
// }

@Bean
public DefaultWebSecurityManager getDefaultWebSecurityManager(SessionManager sessionManager, RedisCacheManager redisCacheManager){DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();myRealm.setCredentialsMatcher(myCredentialsMatcher);defaultWebSecurityManager.setRealm(myRealm);

// defaultWebSecurityManager.setSessionManager(sessionManager);
defaultWebSecurityManager.setCacheManager(redisCacheManager);
return defaultWebSecurityManager;
}

@Bean
public ShiroFilterFactoryBean getShiroFilterFactoryBean(DefaultWebSecurityManager defaultWebSecurityManager,JwtFilter jwtFilter){ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();shiroFilterFactoryBean.setSecurityManager(defaultWebSecurityManager);

// JwtFilter jwtFilter = new JwtFilter();
Map<String, Filter> filterMap = new HashMap<>();
filterMap.put(“jwt”,jwtFilter);
shiroFilterFactoryBean.setFilters(filterMap);
Map<String,String> map = new LinkedHashMap<>();
map.put(“/sys/user/login”,“anon”);
map.put(“/swagger-ui.html**”, “anon”);
map.put(“/v2/api-docs”, “anon”);
map.put(“/swagger-resources/“, “anon”);
map.put(”/webjars/
”, “anon”);
map.put(“/img/“,“anon”);
map.put(”/fastdfs/
”,“anon”);
map.put(“/**”,“jwt”); //取消就不会拦截
shiroFilterFactoryBean.setFilterChainDefinitionMap(map);
// shiroFilterFactoryBean.setLoginUrl(“http://192.168.18.17:3000”);
return shiroFilterFactoryBean;
}

@Bean
public JwtFilter getJwtFilter(){return new JwtFilter();
}/*** 配置shiro redisManager* 使用的是shiro-redis开源插件* @return*/
@Bean
public RedisManager redisManager() {RedisManager redisManager = new RedisManager();redisManager.setHost(redisHost);redisManager.setPort(redisPort);redisManager.setExpire(Math.toIntExact(ExpTime.expTime));// 配置缓存过期时间redisManager.setTimeout(redisTimeout);return redisManager;
}
@Bean
public RedisSessionDAO redisSessionDAO(RedisManager redisManager) {

// RedisSessionDAO redisSessionDAO = new RedisSessionDAO();
RedisSessionDAO redisSessionDAO = new RedisSessionDAO();
redisSessionDAO.setRedisManager(redisManager);
return redisSessionDAO;
}
/**
* shiro session的管理
*/
@Bean
public DefaultWebSessionManager redisSessionManager(RedisSessionDAO redisSessionDAO) {
DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
sessionManager.setSessionDAO(redisSessionDAO);
return sessionManager;
}
@Bean
public RedisCacheManager redisCacheManager(RedisManager redisManager) {
RedisCacheManager redisCacheManager = new RedisCacheManager();
redisCacheManager.setRedisManager(redisManager);
return redisCacheManager;
}

// @Bean
// public FilterRegistrationBean shiroLoginFilteRegistration(JwtFilter filter) {
// FilterRegistrationBean registration = new FilterRegistrationBean(filter);
// registration.setEnabled(false);
// return registration;
// }

}

在这里插入代码片

5.自定义认证逻辑 MyRealm

package com.mes.common.realm;

import com.auth0.jwt.interfaces.Claim;
import com.mes.common.token.JwtToken;
import com.mes.common.utils.JwtUtils;
import com.mes.module.user.dto.SysUserDto;
import com.mes.module.user.service.SysUserService;
import lombok.SneakyThrows;
import org.apache.shiro.authc.*;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**

  • @Description 授权

  • @Date 2021/8/18
    **/
    @Component
    public class MyRealm extends AuthorizingRealm {
    @Autowired
    private SysUserService sysUserService;

    @Override
    public boolean supports(AuthenticationToken token) {
    return token instanceof JwtToken;
    }

    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
    String username = (String) principalCollection.iterator().next();
    SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
    return info;
    }

    @SneakyThrows
    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
    JwtToken jwtToken = (JwtToken) authenticationToken;
    String token = (String) jwtToken.getPrincipal();
    Map<String, Claim> claimMap = JwtUtils.verifyToken(token);
    String username = claimMap.get(“name”).asString();
    Map<String,Object> params = new HashMap<>();
    params.put(“username”, username);
    SysUserDto userDto = sysUserService.getOne(params);
    if (userDto == null){
    return null;
    }

// return new SimpleAuthenticationInfo(userDto,userDto.getPassword(),getName());
return new SimpleAuthenticationInfo(userDto,jwtToken,getName());
}
}

6.密码验证器

package com.mes.common.shiro;import com.mes.common.token.JwtToken;
import com.mes.common.utils.CommonsUtils;
import com.mes.module.user.dto.SysUserDto;
import com.mes.module.user.service.SysUserService;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;import java.util.HashMap;
import java.util.Map;/*** @Description 密码验证器* @Date 2021/8/18**/
@Component
public class MyCredentialsMatcher extends SimpleCredentialsMatcher {@Autowiredprivate SysUserService sysUserService;@Overridepublic boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {JwtToken jwtToken = (JwtToken) token;if (jwtToken.getPassword() == null){return true;}String inPassword = new String(jwtToken.getPassword());SysUserDto dto = (SysUserDto) info.getPrincipals();String username = dto.getUsername();String dbPassword = String.valueOf(info.getCredentials());Map<String,Object> params = new HashMap<>();params.put("username",username);SysUserDto dbUser = sysUserService.getOne(params);String salt = dbUser.getSalt();if (CommonsUtils.encryptPassword(inPassword,salt).equals(dbPassword)){return true;}else {return false;}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/851744.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

学习Pr有哪些常见的使用的技巧?

本Premiere 学习笔记总结常见问题165条。不管你是初学的小白&#xff0c;或是刚进入剪辑学习软件阶段&#xff0c;还是说你学软件好几年了都有用处。因为这份总结涉及到了Pr的各个方面。既可以帮你解决软件出现的问题&#xff0c;也可以帮你熟知软件的实际应用&#xff0c;以及…

C# WPF入门学习番外篇(二) —— C# WPF使用数据库创建注册登录界面

C# WPF入门学习番外篇&#xff08;二&#xff09; —— C# WPF使用数据库创建注册登录界面 在这篇番外篇博客中&#xff0c;我们将介绍如何在C# WPF应用程序中使用数据库来创建一个简单的注册和登录界面。通过本教程&#xff0c;你将学习到如何在WPF中与数据库进行交互&#xf…

网格细分技术在AI绘画中的革新应用

导语&#xff1a; 随着人工智能技术的不断突破&#xff0c;艺术创作也迈入了一个新的时代。AI绘画不仅为艺术家提供了新的工具和灵感源泉&#xff0c;还极大地扩展了艺术的边界。在这背后&#xff0c;网格细分技术扮演着至关重要的角色&#xff0c;它通过将画面划分为数以万计的…

Android低代码开发 - 直接创建一个下拉刷新列表界面

看了我Android低代码开发 - 让IDE帮你写代码这篇文章的小伙伴&#xff0c;大概都对Dora全家桶开发框架有基本的认识了吧。本篇文章将会讲解如何使用dora-studio-plugin快捷创建一个下拉刷新列表界面。 效果演示 这样直接通过图形界面的方式就创建好了下拉刷新上拉加载空态界面…

旅游行业电商平台:数字化转型的引擎与未来发展趋势

引言 旅游行业数字化转型的背景和重要性 随着信息技术的飞速发展&#xff0c;数字化转型成为各行业发展的必然趋势。旅游行业&#xff0c;作为一个高度依赖信息和服务的领域&#xff0c;数字化转型尤为重要。通过数字化手段&#xff0c;旅游行业能够实现资源的高效配置、服务的…

用映射对比ab俩个数组 , 并把a的参数传递给b

项目背景 : react ant 需求 : 在项目进行表头设置时,根据aaa中的key和bbb中的name对应 , 并将sort值插入到bbb中 其中 a b 结构如下 具体实现 aaa[ { key: "orderNumber", orderNumber: "工单编号", sort: 1 } ... ]bbb [ { name: "orderNumber…

Jenkins For Windows编译构建C#项目环境搭建(完整版)

安装Jenkins 下载Windows安装包 官方下载地址 选择稳定版&#xff0c;这里下载的是最新版&#xff0c;如需下载指定版本点击 以前的发行版 配置java环境 下载 java jdk 17 jdk17官方下载链接 这里下载的是msi版本的安装包 安装jdk17 双击运行安装包&#xff0c;一直下…

3D数字化营销——电商行业提升转化率,降低退货率的杀手锏!

随着3D、AR等前沿技术的蓬勃发展&#xff0c;电商行业正迎来一场3D数字化营销的革命。这种创新的营销方式不仅极大地丰富了商品的展现形式&#xff0c;还成功弥补了传统电商在临场感和体验感方面的不足&#xff0c;从而显著提升了消费者的购物体验。 51建模网为电商行业提供3D…

WebSocket 快速入门 与 应用

WebSocket 是一种在 Web 应用程序中实现实时、双向通信的技术。它允许客户端和服务器之间建立持久性的连接&#xff0c;以便可以在两者之间双向传输数据。 以下是 WebSocket 的一些关键特点和工作原理&#xff1a; 0.特点&#xff1a; 双向通信&#xff1a;WebSocket 允许服务…

[AI Stability] 开源AI新利器:Stable Diffusion 3 Medium震撼发布!文本到图像再升级!

Stable Diffusion 3 Medium(SD3) 开源了&#xff0c;我们来看下。 关键要点 Stable Diffusion 3 Medium 是 Stability AI 迄今为止最先进的文本到图像开源模型。该模型的体积小巧&#xff0c;非常适合在消费级 PC 和笔记本电脑上运行&#xff0c;也适合在企业级 GPU 上运行。…

产品经理简要介绍主流电商平台商品API接口的重要应用价值

主流电商平台&#xff1a; 截至目前&#xff08;2024年6月&#xff09;&#xff0c;主流电商平台通常指的是国内外知名的在线购物平台&#xff0c;包括但不限于以下几家&#xff1a; 1. 中国电商平台&#xff1a; - 淘宝网&#xff08;taobao.com&#xff09; - 天猫商…

端午消费数据:“下沉”“价跌”延续

端午假期消费延续了五一的“下沉”与“价跌”趋势。一是人均旅游支出的恢复程度&#xff0c;仍不及2019年&#xff08;恢复至89.5%&#xff09;&#xff1b;二是三线以下城市继续成为旅游新增长点&#xff0c;其平台订单热度高于部分一线和新一线城市。三是国内、国际机票酒店价…

自动同步库数据——kettle开发36

kettle中的那些人工智能。 一、kettle的AI能力目录 跨库同步 2.自动开发 3.自动优化 二、AI实例 1、跨库同步 sqlsever表同步至oracle数据库 1.1源库sqlserver 1.2目标库oracle 1.3可视化跨库同步 使用多表复制向导 选择跨库的表&#xff0c;下一步下一步&#xff0c;即可…

Javaweb避坑指北(持续更新)

内容较多可按CtrlF搜索 0.目录 1.获取插入数据后自增长主键的值 2.Controller中返回给ajax请求字符串/json会跳转到xxx.jsp 3.ajax请求获得的json无法解析 4.在Controller中使用ServletFileUpload获取的上传文件为null 5.莫名其妙报service和dao里方法的错误 6.ajax请求拿…

DeepSpeed Monitoring Comm. Logging

Monitoring 支持多种后端&#xff1a;Tensorboard、WandB、Comet、CSV文件&#xff1b; TensorBoard例子&#xff1a; 自动监控&#xff1a;DeepSpeed自动把重要metric记录下来。只需在配置文件里enable相应的看板后端即可&#xff1a; {"tensorboard": {"enabl…

Linux-笔记 全志平台OTG虚拟 串口、网口、U盘笔记

前言&#xff1a; 此文章方法适用于全志通用平台&#xff0c;并且三种虚拟功能同一时间只能使用一个&#xff0c;原因是此3种功能都是内核USB Gadget precomposed configurations的其中一个选项&#xff0c;只能单选&#xff0c;不能多选&#xff0c;而且不能通过修改配置文件去…

湖北省七普分乡、镇、街道数据,shp、excel格式 需要自取

数据名称: 湖北省七普分乡、镇、街道数据 数据格式: Shp、excel 数据几何类型: 面 数据坐标系: WGS84 数据时间&#xff1a;2020年 数据来源&#xff1a;网络公开数据 数据可视化.

Vue27-内置指令04:v-once指令

一、需求 二、v-once指令 获取初始值&#xff1a; 三、小结

VBA实战(Excel)(6):报错处理

前言 在运行VBA的过程中会有一些报错&#xff0c;例如类型不匹配等运行错误。On Error错误处理程序能直接有效的解决报错。但是当程序逻辑复杂时&#xff0c; 使用On Error会掩盖其他的未知错误&#xff0c;所以应尽可能想办法排除错误&#xff0c;或在已知功能范围内使用。 …

[NCTF 2018]flask真香

打开题目后没有提示框&#xff0c;尝试扫描后也没有什么结果&#xff0c;猜想是ssti。所以尝试寻找ssti的注入点并判断模版。 模版判断方式&#xff1a; 在url地址中输入{7*7} 后发现不能识别执行。 尝试{{7*7}} ,执行成功&#xff0c;继续往下走注入{{7*7}}&#xff0c;如果执…