token过期时间没有设置有默认过期时间么
时间: 2024-01-17 09:04:24 浏览: 31
是的,在PigX中,如果没有显式地设置token过期时间,系统会默认使用一个过期时间,该过期时间可以在网关模块的配置文件中进行配置。具体来说,可以在`application.yml`文件中添加以下配置:
```
spring:
cloud:
gateway:
routes:
- id: auth-service
uri: lb://auth-service
predicates:
- Path=/auth/**
filters:
- StripPrefix=1
- name: RequestRateLimiter
args:
key-resolver: "#{@ipKeyResolver}"
redis-rate-limiter.replenishRate: 1
redis-rate-limiter.burstCapacity: 1
# 设置默认的token失效时间为30分钟
metadata:
token-timeout: 1800000
```
在上述配置中,`metadata`节点下的`token-timeout`属性用于设置默认的token过期时间,单位为毫秒。上述配置将默认的token过期时间设置为30分钟。如果在具体的API中没有设置token过期时间,系统就会使用这个默认的过期时间。当然,如果在API中显式地设置了过期时间,就会使用API中设置的过期时间。