-
Notifications
You must be signed in to change notification settings - Fork 43
JWT验证中间件
YoyoFx edited this page Aug 20, 2020
·
2 revisions
在application.server.jwt 节点下,配置如下
application:
name: demo
server:
# ........
jwt:
header: "Authorization"
secret: "12391JdeOW^%$#@"
prefix: "Bearer"
expires: 3
enable: true
skip_path: [
"/info",
"/v1/user/GetInfo"
]
- header 设置要获取jwt的http头信息
- secret 生成token的密钥
- prefix http头信息中token的前缀,比如 Bearer eyJhbGciOiJIUzI1NiIsIn......... , Bearer就是prefix.
- expires 获取token的过期时间为int64类型,单位为小时.
- enable 设置jwt验证是否启用 false 则不进行jwt信息验证.
- skip_path 是要跳过验证的路由数组.