/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.core.secure.properties;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Data;

/**
 * 客户端校验配置
 *
 * @author Chill
 */
@Data
@ConfigurationProperties("blade.secure")
public class BladeSecureProperties {

	/**
	 * 开启鉴权规则
	 */
	private Boolean enabled = true;

	/**
	 * 鉴权放行请求
	 */
	private final List<String> skipUrl = new ArrayList<>();

	/**
	 * 默认放行规则
	 */
	private final List<String> defaultExcludePatterns = new ArrayList<>();
	
	public BladeSecureProperties() {
		this.defaultExcludePatterns.add("/favicon.ico");
		this.defaultExcludePatterns.add("/error/**");
		this.defaultExcludePatterns.add("/assets/**");
		this.defaultExcludePatterns.add("/doc.html");
		this.defaultExcludePatterns.add("/js/**");
		this.defaultExcludePatterns.add("/v2/api-docs/**");
		this.defaultExcludePatterns.add("/webjars/**");
		this.defaultExcludePatterns.add("/swagger-resources/**");
		this.defaultExcludePatterns.add("/druid/**");
		this.defaultExcludePatterns.add("/test/**");
		
		//业务接口放行
		this.defaultExcludePatterns.add("/blade-auth/**");
		this.defaultExcludePatterns.add("/blade-system/menu/routes");
		this.defaultExcludePatterns.add("/blade-system/menu/auth-routes");
		this.defaultExcludePatterns.add("/blade-system/menu/top-menu");
		this.defaultExcludePatterns.add("/blade-system/tenant/info");
	}
}
