com.yahoo.elide.annotation.SecurityCheck Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2018, the original author or authors.
* Copyright 2019, Yahoo Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE file in project root for terms.
*/
package com.yahoo.elide.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* A convenience annotation that help you register elide check.
*
* Example:
*
* @SecurityCheck("i am an expression")
* public static class{@literal Inline} extends{@literal OperationCheck} {
* @Override
* public boolean ok(Post object, RequestScope requestScope,
* {@literal Optional} changeSpec) {
* return false;
* }
* }
*
*
* NOTE: The class you annotated must be a {@link com.yahoo.elide.core.security.checks.Check},
* otherwise a RuntimeException is thrown.
*
* @author olOwOlo
*
* This class is based on https://github.com/illyasviel/elide-spring-boot/blob/master
* /elide-spring-boot-autoconfigure/src/main/java/org/illyasviel/elide/spring/boot/annotation/ElideCheck.java
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface SecurityCheck {
/**
* The expression which will be used for
* {@link com.yahoo.elide.annotation.ReadPermission#expression()},
* {@link com.yahoo.elide.annotation.UpdatePermission#expression()},
* {@link com.yahoo.elide.annotation.CreatePermission#expression()},
* {@link com.yahoo.elide.annotation.DeletePermission#expression()}.
* @return The expression you want to defined.
*/
String value();
}