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