Files
aida-gateway/src/main/java/com/aida/gateway/config/GatewayAuthProperties.java

32 lines
953 B
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.aida.gateway.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.List;
@Data
@Component
@ConfigurationProperties(prefix = "gateway.auth")
public class GatewayAuthProperties {
private String jwtSecret = "JWTSECRET";
private String jwtTokenHeader = "Authorization";
private String jwtTokenPrefix = "Bearer-";
private List<String> ignorePaths;
/**
* 可选认证路径token 有则解析并写入下游请求头,无则放行。
* 与 ignorePaths 的区别ignorePaths 完全跳过认证逻辑;
* optionalAuthPaths 仍然尝试解析 token有 token 时正常写入 X-User-Id / X-User-Info
* 无 token 时才放行,确保已登录用户的信息能正确传递。
*/
private List<String> optionalAuthPaths;
private boolean blacklistEnabled = true;
}