1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/ainilili-defender

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
README.md 2 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
Nico Отправлено 11.12.2018 14:44 da5df94

Defender

Build Status Maven Central License

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.

Quick start

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

<dependency>
	<groupId>com.smallnico</groupId>
	<artifactId>defender</artifactId>
	<version>${defender.version}</version>
</dependency>

Configuration

@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();
	}
}

Advance

Contributing

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/ainilili-defender.git
git@api.gitlife.ru:oschina-mirror/ainilili-defender.git
oschina-mirror
ainilili-defender
ainilili-defender
master