| | |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.ServletUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.gateway.config.properties.IgnoreWhiteProperties; |
| | |
| | | redisService.expire(getTokenKey(token), EXPIRE_TIME); |
| | | // 设置用户信息到请求 |
| | | ServerHttpRequest mutableReq = exchange.getRequest().mutate().header(CacheConstants.DETAILS_USER_ID, userid) |
| | | .header(CacheConstants.DETAILS_USERNAME, username).build(); |
| | | .header(CacheConstants.DETAILS_USERNAME, ServletUtils.urlEncode(username)).build(); |
| | | ServerWebExchange mutableExchange = exchange.mutate().request(mutableReq).build(); |
| | | |
| | | return chain.filter(mutableExchange); |
| | |
| | | |
| | | return response.writeWith(Mono.fromSupplier(() -> { |
| | | DataBufferFactory bufferFactory = response.bufferFactory(); |
| | | return bufferFactory.wrap(JSON.toJSONBytes(R.fail(msg))); |
| | | return bufferFactory.wrap(JSON.toJSONBytes(R.fail(HttpStatus.UNAUTHORIZED.value(), msg))); |
| | | })); |
| | | } |
| | | |