1.Shiro
realms,users,roles,permissions
Factory
SecurityManager
SecurityUtils.setSecurityManager(securityManager);
//获取当前的用户对象Subject
Subject current = SecurityUtils.getSubject();
//判断当前用户是否被认证
current.isAuthenticated()
UsernamePassword token
token.setRememberMe(true);
//执行登录操作
current.login(token);
current.getPrincipal
hasRole isPermitted
//注销
current.logout()
2.swagger
在项目中使用Swagger 需要Springbox
swagger2、UI
测试运行 http://localhost:8080/swagger-ui.html
3.配置Swagger
Swagger的bean实例Docket;
4.spring boot2.6.1 继承swagger报错:
swagger Failed to start bean 'documentationPluginsBootstrapper'; nested exception is java.lang.NullPointerException
因为Springfox使用的路径匹配是基于AntPathMatcher的,而Spring Boot 2.6.X使用的是PathPatternMatcher。
解决办法,修改application.yaml
spring.mvc.pathmatch.matching-strategy=ant_path_matcher
AntPathMatcher进行的是纯字符串操作和比对
而PathPattern则对于任何一个字符串的pattern最终都会被解析为若干段的PathElement,
这些PathElement以链式结构连接起来用以表示该pattern,形成一个对象数据,
5./禁止谁能访问
initParameters.put("kua","192.168.1.2");*/
bean.setInitParameters(initParameters);//设置初始化参数
return bean;
}
//filter
@Bean
public FilterRegistrationBean webStatFilter(){
FilterRegistrationBean bean = new FilterRegistrationBean();
bean.setFilter(new WebStatFilter());
//过滤请求
Map



