Package org.gbif.api.model.common
Class GbifUserPrincipal
- java.lang.Object
-
- org.gbif.api.model.common.GbifUserPrincipal
-
- All Implemented Interfaces:
Principal
,ExtendedPrincipal
public class GbifUserPrincipal extends Object implements ExtendedPrincipal
A wrapper class for a GBIF User that exposes the unique account name as the principal name. Replacement forUserPrincipal
-
-
Constructor Summary
Constructors Constructor Description GbifUserPrincipal(GbifUser user)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
GbifUser
getUser()
boolean
hasRole(String role)
Checks if the user has the given string based role.
-
-
-
Constructor Detail
-
GbifUserPrincipal
public GbifUserPrincipal(GbifUser user)
-
-
Method Detail
-
hasRole
public boolean hasRole(String role)
Checks if the user has the given string based role. We use strings here and not the enum to facilitate the use of the method with the standard SecurityContext which uses Strings for roles.- Specified by:
hasRole
in interfaceExtendedPrincipal
- Parameters:
role
- case insensitive role- Returns:
- true if the user has the requested role
-
-