java.lang.Object
com.irurueta.authserver.resourceserver.api.web.security.BearerAuthorities

public final class BearerAuthorities extends Object
Maps the roles claim of a token onto authorities, for both JWT and opaque tokens.
  • Field Details

  • Constructor Details

    • BearerAuthorities

      private BearerAuthorities()
      Utility class: not meant to be instantiated.
  • Method Details

    • roleAuthorities

      public static Collection<org.springframework.security.core.GrantedAuthority> roleAuthorities(Collection<String> roles)
      Maps role names to authorities, adding the ROLE_ prefix when it is missing.
      Parameters:
      roles - role names; may be null.
      Returns:
      the role authorities, empty when there are no roles.
    • isAdministrator

      public static boolean isAdministrator(org.springframework.security.core.Authentication authentication)
      Tells whether the caller is an administrator.
      Parameters:
      authentication - the authenticated caller.
      Returns:
      true when it holds ROLE_ADMIN.