net.dreamlu.mica.xss.config.MicaXssProperties Maven / Gradle / Ivy
Show all versions of mica-xss Show documentation
/*
* Copyright (c) 2019-2029, Dreamlu 卢春梦 ([email protected] & www.dreamlu.net).
*
* Licensed under the GNU LESSER GENERAL PUBLIC LICENSE 3.0;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.html
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.dreamlu.mica.xss.config;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import java.util.ArrayList;
import java.util.List;
/**
* Xss配置类
*
* @author L.cm
*/
@Getter
@Setter
@RefreshScope
@ConfigurationProperties(MicaXssProperties.PREFIX)
public class MicaXssProperties {
public static final String PREFIX = "mica.xss";
/**
* 开启xss
*/
private boolean enabled = true;
/**
* 全局:对文件进行首尾 trim
*/
private boolean trimText = true;
/**
* 模式:clear 清理(默认),escape 转义
*/
private Mode mode = Mode.CLEAR;
/**
* [clear 专用] prettyPrint,默认关闭: 保留换行
*/
private boolean prettyPrint = false;
/**
* [clear 专用] 使用转义,默认关闭
*/
private boolean enableEscape = false;
/**
* 拦截的路由,默认为空
*/
private List pathPatterns = new ArrayList<>();
/**
* 放行的路由,默认为空
*/
private List pathExcludePatterns = new ArrayList<>();
public enum Mode {
/**
* 清理
*/
CLEAR,
/**
* 转义
*/
ESCAPE,
/**
* 校验,抛出异常
*/
VALIDATE
}
}