Annotation Interface HumanOnly
@Target({METHOD,TYPE})
@Retention(RUNTIME)
@Inherited
@Documented
@PreAuthorize("hasAuthority(\'TYPE_HUMAN\')")
public @interface HumanOnly
Enforces access restriction to endpoint(s) to users that are not applications.
It enforce role requirements with PreAuthorize using Spring login.
Code annotated with HumanOnly
@GetMapping("test")
@HumanOnly
ResponseEntity testMethod()
is equivalent of code annotated with both PreAuthorize
@GetMapping("test")
@PreAuthorize("hasRole('TYPE_HUMAN')")
ResponseEntity testMethod()