Annotation Interface AuthenticationRequired


@Target(TYPE) @Retention(RUNTIME) @Resource public @interface AuthenticationRequired
Annotation used to indicate that authentication is required for the annotated element. This annotation can be applied to methods or classes in Spring RestController.

Example usage:


 @RestController
 @AuthenticationRequired
 public class SecureResource {
     @GetMapping
     public ResponseEntity getSecureResource() {
         // Code here
     }
 }
 

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    boolean
    Specifies whether logging is enabled for the annotated element.
    Define the type of the authentication required by the annotated element.
  • Element Details

    • value

      @AliasFor(annotation=Authentication.class) String[] value
      Define the type of the authentication required by the annotated element. By default Feature.QUICK will be used
      Returns:
      the type of authentication required by the annotated element
      See Also:
      Default:
      {"QUICK"}
    • logging

      @AliasFor(annotation=Resource.class, attribute="logging") boolean logging
      Specifies whether logging is enabled for the annotated element.
      Returns:
      true if logging is enabled, false otherwise
      See Also:
      Default:
      false