注解实现Controller从header中解析Jwt并注入到参数中
场景需求为: gateway给header中存了jwt,jwt存了多个信息,可能有角色,uid,权限等,需要一个注解,在Controller上,使用@JwtClaimParam("userId") Long userId 将jwt中的userId解析出来并注入Controller参数的userId中。 1. 定义注解 import java.lang.an…
331 2023-07-07 去围观场景需求为: gateway给header中存了jwt,jwt存了多个信息,可能有角色,uid,权限等,需要一个注解,在Controller上,使用@JwtClaimParam("userId") Long userId 将jwt中的userId解析出来并注入Controller参数的userId中。 1. 定义注解 import java.lang.an…
331 2023-07-07 去围观