Package com.netflix.spinnaker.security
Class SpinnakerAuthorities
java.lang.Object
com.netflix.spinnaker.security.SpinnakerAuthorities
Constants and utilities for working with Spring Security GrantedAuthority objects specific to
Spinnaker and Fiat. Spinnaker-specific roles are represented here as granted authorities with the
SPINNAKER_ prefix.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final org.springframework.security.core.GrantedAuthorityGranted authority for Spinnaker administrators.static final org.springframework.security.core.GrantedAuthorityGranted authority for anonymous users. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.security.core.GrantedAuthorityforRoleName(String role) Creates a granted authority corresponding to the provided name of a role.getRoles(org.springframework.security.core.Authentication authentication) Gets the list of roles assigned to the given user.static booleanhasAnyRole(org.springframework.security.core.Authentication authentication, Collection<String> roles) Checks if the given user has any of the provided roles.static booleanChecks if the given user has the provided role.static booleanisAdmin(org.springframework.security.core.Authentication authentication) Checks if the given user is a Spinnaker admin.
-
Field Details
-
ADMIN
- See Also:
-
ADMIN_AUTHORITY
public static final org.springframework.security.core.GrantedAuthority ADMIN_AUTHORITYGranted authority for Spinnaker administrators. -
ANONYMOUS_AUTHORITY
public static final org.springframework.security.core.GrantedAuthority ANONYMOUS_AUTHORITYGranted authority for anonymous users.
-
-
Constructor Details
-
SpinnakerAuthorities
public SpinnakerAuthorities()
-
-
Method Details
-
forRoleName
@Nonnull public static org.springframework.security.core.GrantedAuthority forRoleName(@Nonnull String role) Creates a granted authority corresponding to the provided name of a role. -
isAdmin
public static boolean isAdmin(@Nullable org.springframework.security.core.Authentication authentication) Checks if the given user is a Spinnaker admin. -
hasRole
public static boolean hasRole(@Nullable org.springframework.security.core.Authentication authentication, @Nonnull String role) Checks if the given user has the provided role. -
hasAnyRole
public static boolean hasAnyRole(@Nullable org.springframework.security.core.Authentication authentication, @Nonnull Collection<String> roles) Checks if the given user has any of the provided roles. -
getRoles
@Nonnull public static List<String> getRoles(@Nullable org.springframework.security.core.Authentication authentication) Gets the list of roles assigned to the given user.
-