Skip to content

Authorization

Permission Check within method for custom logic

Permissions can be check for customization within a method by getting the Context:

UserDetails userDetails = (UserDetails) SecurityContextHolder.getContext().getAuthentication().getPrincipal();

userDetails.getAuthorities().forEach(grantedAuthority -> {
  log.debug("Granted Authority: {}", grantedAuthority.getAuthority());
});

Comments