Package io.automatiko.engine.api.auth
Interface IdentityProvider
-
- All Known Implementing Classes:
TrustedIdentityProvider
public interface IdentityProviderDelivers security information about given identity that includes name and assigned roles.
-
-
Field Summary
Fields Modifier and Type Field Description static ThreadLocal<IdentityProvider>currentstatic StringUNKNOWN_USER_IDENTITY
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static IdentityProviderget()Returns currently associated IdentityProviderStringgetName()Returns name assigned to the current context, usually refers to user nameList<String>getRoles()Returns roles assigned to the current context if anybooleanhasRole(String role)Checks if given role is assigned to current contextdefault booleanisAdmin()Checks if given identity is an adminstatic booleanisSet()Map<String,Map<String,String>>properties()Returns map of additional properties that can be consumed byAccessPolicyimplementationsstatic voidset(IdentityProvider identityProvider)
-
-
-
Field Detail
-
UNKNOWN_USER_IDENTITY
static final String UNKNOWN_USER_IDENTITY
- See Also:
- Constant Field Values
-
current
static final ThreadLocal<IdentityProvider> current
-
-
Method Detail
-
getName
String getName()
Returns name assigned to the current context, usually refers to user name- Returns:
- assigned name taken from security context
-
getRoles
List<String> getRoles()
Returns roles assigned to the current context if any- Returns:
- list of assigned roles or empty list
-
hasRole
boolean hasRole(String role)
Checks if given role is assigned to current context- Parameters:
role- role to be checked- Returns:
- true if the role is found otherwise null
-
isAdmin
default boolean isAdmin()
Checks if given identity is an admin- Returns:
- returns true if the identity has admin rights otherwise false
-
properties
Map<String,Map<String,String>> properties()
Returns map of additional properties that can be consumed byAccessPolicyimplementations- Returns:
- non null map of properties
-
get
static IdentityProvider get()
Returns currently associated IdentityProvider- Returns:
- current identity provider
-
set
static void set(IdentityProvider identityProvider)
-
isSet
static boolean isSet()
-
-