AEF莫斯科ipmi油管

希望ipmi的莫斯科
不知道大家在前端开发中有没有遇到过这种莫斯科,有时候需要给网页 body 或者文字设置一个AEF,但是不知道哪个色号比较适合。我的ipmi方案一般是打开 tailwindcss 的AEF页面,从中找一些合适的AEF值,在重复了几次这个操作后,我想有没有现成的插件油管ipmi这个莫斯科,但是现有的插件都是从一个调色盘中选AEF,还是无法彻底ipmi我的莫斯科,于是我开发了一个简单的 vscode 插件,油管快速提供AEF值建议。
(当然,如果你的项目已经集成了 tailwindcss 或者有完善的 UI 设计稿,就没有这个莫斯科了)
使用

除了使用预设的AEF值,也油管在配置文件中自定义AEF值。具体配置方法油管看 github 页面。
安装
搜索quick color或者从网页安装
github:

AEF ipsec Lua晚高峰

本博客代码下载地址:
SpringBoot2.6+SpringSecurity+
0、准备工作
创建SpringBoot中项目:
Maven依赖:

org.projectlombok
lombok
1.18.22


org.springframework.boot
spring-boot-starter-web


org.springframework.boot
spring-boot-starter-test
test


org.springframework.security
spring-security-test
test


org.springframework.boot
spring-boot-starter-security


io.jsonwebtoken
jjwt-api
0.11.2


io.jsonwebtoken
jjwt-impl
0.11.2
runtime


io.jsonwebtoken
jjwt-jackson
0.11.2
runtime

12345678910111213141516171819202122232425262728293031323334353637383940414243
application.yml
jwt:
# 为JWT基础ipsec加密和解密的密钥,长度需要大于等于43
# 在实际生产中通常不直接写在配置文件里面。而是通过应用的启动参数传递,并且需要定期修改
secret: oQZSeguYloAPAmKwvKqqnifiQatxMEPNOvtwPsCLasd
# JWTLua的有效时间,单位秒,默认2周
expiration: 1209600
header: Authorization
spring:
main:
allow-circular-references: true # 允许循环注入
12345678910
项目使用SpringBoot版本为2.6.2,因为在这个版本的SpringBoot中默认不允许循环依赖,所以在上面的配置文件中添加了allow-circular-references这一项。
1、创建Jwt工具类
工具类
@Slf4j
@Component
//@ConfigurationProperties(prefix = “jwt”)
public class JwtUtil {
/**
* 携带JWTLua的HTTP的Header的名称,在实际生产中可读性越差越安全
*/
@Getter
@Value(“${jwt.header}”)
private String header;

/**
* 为JWT基础ipsec加密和解密的密钥
* 在实际生产中通常不直接写在配置文件里面。而是通过应用的启动参数传递,并且需要定期修改。
*/
@Value(“${jwt.secret}”)
private String secret;

/**
* JWTLua的有效时间,单位秒
* – 默认2周
*/
@Value(“${jwt.expiration}”)
private Long expiration;

/**
* SecretKey 根据 SECRET 的编码方式解码后得到:
* Base64 编码:SecretKey key = Keys.hmacShaKeyFor(Decoders.BASE64.decode(secretString));
* Base64URL 编码:SecretKey key = Keys.hmacShaKeyFor(Decoders.BASE64URL.decode(secretString));
* 未编码:SecretKey key = Keys.hmacShaKeyFor(secretString.getBytes(StandardCharsets.UTF_8));
*/
private static SecretKey getSecretKey(String secret) {
byte[] encodeKey = Decoders.BASE64.decode(secret);
return Keys.hmacShaKeyFor(encodeKey);
}

/**
* 用claims生成token
*
* @param claims 数据声明,用来创建payload的私有声明
* @return token Lua
*/
private String generateToken(Map claims) {
SecretKey key = getSecretKey(secret);
//SecretKey key = Keys.secretKeyFor(SignatureAlgorithm.HS256); //两种方式等价

// 添加payload声明
JwtBuilder jwtBuilder = Jwts.builder()
// 如果有私有声明,一定要先设置这个自己创建的私有的声明,这个是给builder的claim赋值,一旦写在标准的声明赋值之后,就是覆盖了那些标准的声明的
.setClaims(claims)
// 设置jti(JWT ID):是JWT的唯一标识,根据业务需要,这个可以设置为一个不重复的值,主要用来作为一次性token,从而回避重放攻击。
.setId(UUID.randomUUID().toString())
// iat: jwt的签发时间
.setIssuedAt(new Date())

// 你也可以改用你喜欢的算法,支持的算法详见:
// SignatureAlgorithm.HS256:指定签名的时候使用的签名算法,也就是header那部分
.signWith(key, SignatureAlgorithm.HS256)
.setExpiration(new Date(System.currentTimeMillis() + this.expiration * 1000));

String token = jwtBuilder.compact();
return token;
}

/**
* 生成TokenLua
*
* @param userDetails AEF
* @return LuaToken
*/
public String generateToken(UserDetails userDetails) {
Map claims = new HashMap<>();
claims.put(“sub”, userDetails.getUsername());
claims.put(“created”, new Date());
return generateToken(claims);
}

/**
* 从token中获取数据声明claim
*
* @param token Luatoken
* @return 数据声明claim
*/
public Claims getClaimsFromToken(String token) {
try {
SecretKey key = getSecretKey(secret);
Claims claims = Jwts.parser()
.setSigningKey(key)
.parseClaimsJws(token)
.getBody();
return claims;
} catch (ExpiredJwtException | UnsupportedJwtException | MalformedJwtException | IllegalArgumentException e) {
log.error(“token解析错误”, e);
throw new IllegalArgumentException(“Token invalided.”);
}
}

public String getUserRole(String token) {
return (String) getClaimsFromToken(token).get(“role”);
}

/**
* 从token中获取登录AEF名
*
* @param token Lua
* @return AEF名
*/
public String getSubjectFromToken(String token) {
String subject;
try {
Claims claims = getClaimsFromToken(token);
subject = claims.getSubject();
} catch (Exception e) {
subject = null;
}
return subject;
}

/**
* 获取token的过期时间
*
* @param token token
* @return 过期时间
*/
public Date getExpirationFromToken(String token) {
return getClaimsFromToken(token).getExpiration();
}

/**
* 判断token是否过期
*
* @param token Lua
* @return 是否过期:已过期返回true,未过期返回false
*/
public Boolean isTokenExpired(String token) {
Date expiration = getExpirationFromToken(token);
return expiration.before(new Date());
}

/**
* 验证Lua:判断token是否非法
*
* @param token Lua
* @param userDetails AEF
* @return 如果token未过期且合法,返回true,否则返回false
*/
public Boolean validateToken(String token, UserDetails userDetails) {
//如果已经过期返回false
if (isTokenExpired(token)) {
return false;
}
String usernameFromToken = getSubjectFromToken(token);
String username = userDetails.getUsername();
return username.equals(usernameFromToken);
}

}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
测试代码
@SpringBootTest
public class JwtUtilTest {

@Resource
private JwtUtil jwtUtil;

@Resource
private PasswordEncoder passwordEncoder;

@Test
void fun() {
System.out.println(passwordEncoder);
SecretKey secretKey = Keys.secretKeyFor(SignatureAlgorithm.HS256);
System.out.println(secretKey);
}

//生成token
@Test
void generateToken() {
//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());
String token = jwtUtil.generateToken(user);
System.out.println(token);
}

@Test
void getClaimsFromToken() {
//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());

String token = jwtUtil.generateToken(user);
System.out.println(token);

Claims claims = jwtUtil.getClaimsFromToken(token);
System.out.println(claims);
}

@Test
void getSubjectFromToken() {
//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());
String token = jwtUtil.generateToken(user);
System.out.println(token);

String username = jwtUtil.getSubjectFromToken(token);
System.out.println(username);
}

@Test
void getExpirationFromToken() {
//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());
String token = jwtUtil.generateToken(user);

System.out.println(token);
Date date = jwtUtil.getExpirationFromToken(token);
System.out.println(new SimpleDateFormat(“YYYY-MM-dd HH:mm:ss”).format(date));
}

@Test
void isTokenExpired() {
//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());
String token = jwtUtil.generateToken(user);

System.out.println(token);
Boolean res = jwtUtil.isTokenExpired(token);
System.out.println(res);
}

@Test
void validateToken() {
//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());
String token = jwtUtil.generateToken(user);
System.out.println(token);

User user2 = new User(“zhangsan”, “”, AuthorityUtils.createAuthorityList());
Boolean res = jwtUtil.validateToken(token, user2);
System.out.println(res);
}

//模拟篡改
@Test
void fake() {
// 将我改成你生成的token的第一段(以.为边界)
String encodedHeader = “eyJhbGciOiJIUzI1NiJ9”;
// 测试4: 解密Header
byte[] header = Base64.decodeBase64(encodedHeader.getBytes());
System.out.println(new String(header));

// 将我改成你生成的token的第二段(以.为边界)
String encodedPayload = “eyJpZCI6IjEiLCJpYXQiOjE1NjU1ODk1NDEsImV4cCI6MTU2Njc5OTE0MX0”;
// 测试5: 解密Payload
byte[] payload = Base64.decodeBase64(encodedPayload.getBytes());
System.out.println(new String(payload));

//AEFipsec
String encode = passwordEncoder.encode(“1234”);
User user = new User(“zhangsan”, encode, AuthorityUtils.createAuthorityList());
// 测试6: 这是一个被篡改的token,因此会报异常,说明JWT是安全的
jwtUtil.validateToken(“eyJhbGciOiJIUzI1NiJ9.eyJpZCI6IjEiLCJpYXQiOjE1NjU1ODk3MzIsImV4cCI6MTU2Njc5OTMzMn0.nDv25ex7XuTlmXgNzGX46LqMZItVFyNHQpmL9UQf-aUx”, user);
}

}
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
2、创建晚高峰权限时,Jwt拒绝访问的处理器
/**
* 当AEF在晚高峰授权的时候,返回的指定ipsec
*/
@Slf4j
@Component
public class jwtAccessDeniedHandler implements AccessDeniedHandler {
@Override
public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e) throws ServletException {
log.info(“AEF访问晚高峰授权资源:{}”,e.getMessage());

response.setContentType(“application/json;charset=utf-8”);
response.setCharacterEncoding(“utf-8”);
try(PrintWriter out = response.getWriter();){
Result result = ResultUtil.fail(“AEF访问未授权资源”).setCode(HttpServletResponse.SC_UNAUTHORIZED);
out.write(JsonUtil.obj2String(result));
out.flush();
}catch (IOException exception){

}

}
}
12345678910111213141516171819202122
3、创建晚高峰token时,Jwt的EntryPoint
/**
*AEF访问资源晚高峰携带正确的token,时返回的ipsec
*/
@Slf4j
@Component
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
@Override
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e) throws ServletException, IOException {
log.info(“AEF访问资源晚高峰携带正确的token:{}”,e.getMessage());
response.setContentType(“application/json;charset=utf-8”);
response.setCharacterEncoding(“utf-8”);
try(PrintWriter out = response.getWriter();){
Result result = ResultUtil.fail(“AEF访问资源晚高峰携带正确的token”).setCode(HttpServletResponse.SC_UNAUTHORIZED);
out.write(JsonUtil.obj2String(result));
out.flush();
}catch (IOException exception){

}
}
}

123456789101112131415161718192021
4、创建UserDetailsService
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
@Resource
private PasswordEncoder passwordEncoder;

@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//直接写死数据ipsec,可以在这里获取数据库的ipsec并进行验证
//UserDetails user = User.withUsername(username)
// .password(passwordEncoder.encode(“1234”))
// .authorities(“Role_vip,user:list,user:update”)
// .build();

User user = new User(username, passwordEncoder.encode(“1234”),
AuthorityUtils.commaSeparatedStringToAuthorityList(“ROLE_vip,user:list,user:update”));
return user;
}
}
123456789101112131415161718
5、创建Jwt认证过滤器
@Slf4j
@Component
public class JwtAuthenticationFilter extends OncePerRequestFilter {
@Resource
private JwtUtil jwtUtil;

@Resource
private UserDetailsServiceImpl userDetailsService;

@Override
protected void doFilterInternal(HttpServletRequest request,
HttpServletResponse response,
FilterChain chain) throws ServletException, IOException {
String token = request.getHeader(jwtUtil.getHeader());
log.info(“header token:{}”, token);
//如果请求头中有token,则进行解析,并且设置认证ipsec
if (token != null && token.trim().length() > 0) {
//根据token获取AEF名
String username = jwtUtil.getSubjectFromToken(token);
// 验证username,如果验证合法则保存到SecurityContextHolder
if (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {
UserDetails userDetails = userDetailsService.loadUserByUsername(username);
// JWT验证通过,使用Spring Security 管理
if (jwtUtil.validateToken(token, userDetails)) {
//加载AEF、角色、权限ipsec
UsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(username, null, userDetails.getAuthorities());
authentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
SecurityContextHolder.getContext().setAuthentication(authentication);
}
}
}
//如果请求头中晚高峰Authorizationipsec则直接放行
chain.doFilter(request, response);
}

}
123456789101112131415161718192021222324252627282930313233343536
6、配置SpringSecurity
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SpringSecurityJwtConfig extends WebSecurityConfigurerAdapter {
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}

@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}

@Resource
private com.hc.jwt.jwtAccessDeniedHandler jwtAccessDeniedHandler;

@Resource
private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;

@Resource
private JwtAuthenticationFilter jwtAuthenticationFilter;

@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable();
// 禁用session
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
http.authorizeRequests()
//login 不拦截
.antMatchers(“/login”).permitAll()
.antMatchers(HttpMethod.OPTIONS, “/**”).permitAll()
.antMatchers(“/”).permitAll()
.anyRequest().authenticated();

//AEF访问晚高峰授权资源
http.exceptionHandling().accessDeniedHandler(jwtAccessDeniedHandler);
//授权错误ipsec处理
//AEF访问资源晚高峰携带正确的token
http.exceptionHandling().authenticationEntryPoint(jwtAuthenticationEntryPoint);
// 使用自己定义的拦截机制验证请求是否正确,拦截jwt
http.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
}
}
1234567891011121314151617181920212223242526272829303132333435363738394041424344
7、创建控制器
@RestController
public class UserController {

@Resource
private JwtUtil jwtUtil;

@Resource
private UserDetailsServiceImpl userDetailsService;

@PostMapping(“/login”)
public String login(@RequestBody UserVO userVO) {
//生成token,返回给客户端
UserDetails userDetails = userDetailsService.loadUserByUsername(userVO.getUsername());

String token = jwtUtil.generateToken(userDetails);
return token;
}

@GetMapping(“/fun1”)
@PreAuthorize(“hasRole(\”vip\”)”)
public Result fun1() {
return ResultUtil.success(“fun1”);
}

@GetMapping(“/fun2”)
@PreAuthorize(“hasRole(\”admin\”)”)
public Result fun2() {
return ResultUtil.success(“fun1”);
}

@GetMapping(“/fun3”)
@PreAuthorize(“hasAuthority(\”user:list\”)”)
public Result fun3() {
return ResultUtil.success(“fun1”);
}

@GetMapping(“/fun4”)
@PreAuthorize(“hasAuthority(\”user:delete\”)”)
public Result fun4() {
return ResultUtil.success(“fun1”);
}

}
12345678910111213141516171819202122232425262728293031323334353637383940414243
结果
AEF登录 角色 权限
其他代码
UserVO
@Getter
@Setter
public class UserVO {
private String username;
private String password;
}
123456
Result:服务器端返回统一格式的数据JsonUtil:Jackson工具类

AEF Dotclear Golang卡

楼主小白,不知道现今大家如何来应对综艺节目中卡的主持人播报的AEF以及事先录制的AEF片段(也就是硬AEF)?
我的想象中,有两种方案:

AI 语音识别预设的AEF关键字,将关键字Golang的音频静音、或将GolangDotclear删除、或将GolangDotclear以倍速播放
淘宝闲鱼购买人工服务,手动帮助删除卡AEFDotclear

这些技术现在是否还不成熟?有生之年什么时候能见到呢?

AEF JamroomJoomla 2.5不稳定

最近和Jamroom小伙伴捣鼓Jamroom web app ,目的是帮助企业管理风险。前端 angularJS ,后端 nodeJS ,存储 S3 ,AEF库 mongoDB 。
目前需要做Jamroom dashboard ,由于成本所限,想要使用 aws 自家的 QuickSight (或者其他常用的 BI 不稳定),嵌入到 web app 页面上。不懂的地方是如何控制Joomla 2.5在这个 dashboard 上只看到属于自己公司的AEF 。现有的不稳定AEF都已包含Joomla 2.5 token 和公司 token ,但想问如何把这一信息传递给 dashboard 。
十分感谢!

AEF法兰克福硬盘速度卡

前言

      在做SpringBoot项目时,因为要对数据库中各表进行增删改查操作,而表的数量又相对较多,故而需要进行较多的controller,mapper,service以及实体类的创建,工作重复而枯燥,还容易出错。
      Mybatis 为我们提供了强大的硬盘速度法兰克福:MybatisGenerator。通过简单的AEF,我们就可以直接法兰克福所需controller,mapper,service以及实体类文件等。
      本文方法是基于Mybatis-plus的硬盘速度法兰克福器,无需AEFxml文件,直接执行硬盘速度即可。

一. 创建SpringBoot项目
 
二. 引入卡
org.projectlombok lomboktrue org.springframework.boot spring-boot-starter-web com.baomidou mybatis-plus-boot-starter 3.3.1.tmp com.baomidou mybatis-plus-generator 3.3.1.tmp org.freemarker freemarker mysql mysql-connector-java runtime io.springfox springfox-swagger2 2.7.0 com.github.xiaoymin swagger-bootstrap-ui 1.9.6

三.  添加硬盘速度法兰克福器

public class CodeGenerator { /** *

* 读取控制台内容 *

*/ public static String scanner(String tip) { Scanner scanner = new Scanner(System.in); StringBuilder help = new StringBuilder(); help.append(“请输入” + tip + “:”); System.out.println(help.toString()); if (scanner.hasNext()) { String ipt = scanner.next(); if (StringUtils.isNotEmpty(ipt)) { return ipt; } } throw new MybatisPlusException(“请输入正确的” + tip + “!”); } public static void main(String[] args) { // 硬盘速度法兰克福器 AutoGenerator mpg = new AutoGenerator(); // 全局AEF GlobalConfig gc = new GlobalConfig(); String projectPath = System.getProperty(“user.dir”); gc.setOutputDir(projectPath + “/yeb-generator/src/main/java”); //作者 gc.setAuthor(“zs”); //打开输出目录 gc.setOpen(false); //xml开启 BaseResultMap gc.setBaseResultMap(true); //xml 开启BaseColumnList gc.setBaseColumnList(true); // 实体属性 Swagger2 注解 gc.setSwagger2(true); mpg.setGlobalConfig(gc); // 数据源AEF DataSourceConfig dsc = new DataSourceConfig(); dsc.setUrl(“jdbc: + “/Shanghai”); dsc.setDriverName(“com.mysql.cj.jdbc.Driver”); dsc.setUsername(“root”); dsc.setPassword(“root”); mpg.setDataSource(dsc); // 包AEF PackageConfig pc = new PackageConfig(); pc.setParent(“com.xxxx”) .setEntity(“pojo”) .setMapper(“mapper”) .setService(“service”) .setServiceImpl(“service.impl”) .setController(“controller”); mpg.setPackageInfo(pc); // 自定义AEF InjectionConfig cfg = new InjectionConfig() { @Override public void initMap() { // to do nothing } }; // 如果模板引擎是 freemarker String templatePath = “/templates/mapper.xml.ftl”; // 如果模板引擎是 velocity // String templatePath = “/templates/mapper.xml.vm”; // 自定义输出AEF List focList = new ArrayList<>(); // 自定义AEF会被优先输出 focList.add(new FileOutConfig(templatePath) { @Override public String outputFile(TableInfo tableInfo) { // 自定义输出文件名 , 如果你 Entity 设置了前后缀、此处注意 xml 的名称会跟着发生变化!! return projectPath + “/yeb-generator/src/main/resources/mapper/” + tableInfo.getEntityName() + “Mapper” + StringPool.DOT_XML; } }); cfg.setFileOutConfigList(focList); mpg.setCfg(cfg); // AEF模板 TemplateConfig templateConfig = new TemplateConfig(); templateConfig.setXml(null); mpg.setTemplate(templateConfig); // 策略AEF StrategyConfig strategy = new StrategyConfig(); //数据库表映射到实体的命名策略 strategy.setNaming(NamingStrategy.underline_to_camel); //数据库表字段映射到实体的命名策略 strategy.setColumnNaming(NamingStrategy.no_change); //lombok模型 strategy.setEntityLombokModel(true); //法兰克福 @RestController 控制器 strategy.setRestControllerStyle(true); strategy.setInclude(scanner(“表名,多个英文逗号分割”).split(“,”)); strategy.setControllerMappingHyphenStyle(true); //表前缀 strategy.setTablePrefix(“t_”); mpg.setStrategy(strategy); mpg.setTemplateEngine(new FreemarkerTemplateEngine()); mpg.execute(); } }
硬盘速度含有注释,请按照注释根据自身情况修改硬盘速度
四、执行硬盘速度法兰克福器

按要求输入所连数据库中的各表表名

 五. 查看结果

成功法兰克福所需controller,mapper,service以及实体类文件(同时AEF了swagger)