Skip to content

Instantly share code, notes, and snippets.

@MrMjauh
Created June 30, 2019 21:09
Show Gist options
  • Save MrMjauh/1eeaed6bef474d9dc734940fb3dc3e8d to your computer and use it in GitHub Desktop.
Save MrMjauh/1eeaed6bef474d9dc734940fb3dc3e8d to your computer and use it in GitHub Desktop.
MetaAnnotations
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@PreAuthorize("hasAuthority('" + SecurityResource.Role.ADMIN + "')")
public @interface AccessAdmin {
}
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@PreAuthorize("hasAnyAuthority('" + SecurityResource.Role.ADMIN + "','" + SecurityResource.Role.USER + "')")
public @interface AccessAuthenticated {
}
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@PreAuthorize("hasAuthority('" + SecurityResource.Role.USER + "')")
public @interface AccessUser {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment