package com.vci.starter.web.properties;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Arrays;
|
|
/**
|
* 跨域配置的属性
|
* @author weidy
|
*/
|
@Component
|
@ConfigurationProperties(prefix = "cors")
|
public class CorsProperties {
|
|
/**
|
* 开关
|
*/
|
private String enabled;
|
|
/**
|
* 允许的域名
|
*/
|
private String[] allowedOrigins;
|
/**
|
* 允许的方法
|
*/
|
private String[] allowedMethods;
|
/**
|
* 允许的头
|
*/
|
private String[] allowedHeaders;
|
/**
|
* 暴露的头
|
*/
|
private String[] exposedHeaders;
|
|
/**
|
* 允许的证书
|
*/
|
private Boolean allowCredentials;
|
/**
|
* 映射
|
*/
|
private String mappings;
|
|
/**
|
* 最大量
|
*/
|
private Long maxAge;
|
|
public String getEnabled() {
|
return enabled;
|
}
|
|
public void setEnabled(String enabled) {
|
this.enabled = enabled;
|
}
|
|
public String[] getAllowedOrigins() {
|
return allowedOrigins;
|
}
|
|
public void setAllowedOrigins(String[] allowedOrigins) {
|
this.allowedOrigins = allowedOrigins;
|
}
|
|
public String[] getAllowedMethods() {
|
return allowedMethods;
|
}
|
|
public void setAllowedMethods(String[] allowedMethods) {
|
this.allowedMethods = allowedMethods;
|
}
|
|
public String[] getAllowedHeaders() {
|
return allowedHeaders;
|
}
|
|
public void setAllowedHeaders(String[] allowedHeaders) {
|
this.allowedHeaders = allowedHeaders;
|
}
|
|
public String[] getExposedHeaders() {
|
return exposedHeaders;
|
}
|
|
public void setExposedHeaders(String[] exposedHeaders) {
|
this.exposedHeaders = exposedHeaders;
|
}
|
|
public Boolean getAllowCredentials() {
|
return allowCredentials;
|
}
|
|
public void setAllowCredentials(Boolean allowCredentials) {
|
this.allowCredentials = allowCredentials;
|
}
|
|
public String getMappings() {
|
return mappings;
|
}
|
|
public void setMappings(String mappings) {
|
this.mappings = mappings;
|
}
|
|
public Long getMaxAge() {
|
return maxAge;
|
}
|
|
public void setMaxAge(Long maxAge) {
|
this.maxAge = maxAge;
|
}
|
|
@Override
|
public String toString() {
|
return "CorsProperties{" +
|
"enabled='" + enabled + '\'' +
|
", allowedOrigins=" + Arrays.toString(allowedOrigins) +
|
", allowedMethods=" + Arrays.toString(allowedMethods) +
|
", allowedHeaders=" + Arrays.toString(allowedHeaders) +
|
", exposedHeaders=" + Arrays.toString(exposedHeaders) +
|
", allowCredentials=" + allowCredentials +
|
", mappings='" + mappings + '\'' +
|
", maxAge=" + maxAge +
|
'}';
|
}
|
}
|