Defender is a lightweight, flexible, and highly available permission framework that fully embraces spring-boot.If we need to make it easier to add permission management to the service on a daily basis, Defender is the Defender!
It eliminates the need to repeatedly write custom annotations and facets, and allows you to flexibly specify different patterns of defense networks by simply calling a simple API.
Defender is easy to deploy in two steps, make sure your service USES the spring-boot technology stack before using it, and that you introduce spring-boot-starter aop and spring-boot-starter web modules.
<dependency>
<groupId>com.smallnico</groupId>
<artifactId>defender</artifactId>
<version>${defender.version}</version>
</dependency>
@Configuration
@EnableDefender("* org.nico.trap.controller..*.*(..)")
public class DefenderTestConfig {
@Bean
public Defender init(){
return Defender.getInstance()
.registry(Guarder.builder(GuarderType.URI)
.pattern("POST /user")
.preventer(caller -> {
return caller.getRequest().getHeader("token") == null
? Result.pass() : Result.notpass("error");
}))
.ready();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。