Class PrincipalExtended
java.lang.Object
de.fraunhofer.iosb.ilt.frostserver.util.user.PrincipalExtended
- All Implemented Interfaces:
Principal
A user Principal with role information.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PrincipalExtendedstatic final PrincipalExtendedstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddContextItem(String key, Object value) Add an item to the context, or replace an existing item if an item with the given key already exists.static final PrincipalExtendedfromPrincipal(Principal principal) Turns the given principal into a PrincipalExtended.Get the current context map.getContextItem(String key) Get the context item with the given key, or null if there is no such item.getContextItem(String key, Object dflt) Get the context item with the given key, or dflt if there is no such item.static PrincipalExtendedgetName()getRoles()booleanhasContextItem(String key) Check if the context has an item for the given key.booleanisAdmin()static voidsetContext(Map<String, Object> context) Replace the current context with the given value.static voidsetLocalPrincipal(PrincipalExtended localPrincipal) toString()
-
Field Details
-
USER_NAME_ANONYMOUS
- See Also:
-
ROLE_ADMIN
- See Also:
-
ROLE_DELETE
- See Also:
-
ROLE_UPDATE
- See Also:
-
ROLE_CREATE
- See Also:
-
ROLE_READ
- See Also:
-
ANONYMOUS_PRINCIPAL
-
INTERNAL_ADMIN_PRINCIPAL
-
-
Constructor Details
-
PrincipalExtended
-
-
Method Details
-
getName
-
isAdmin
public boolean isAdmin() -
getRoles
-
toString
-
getContext
Get the current context map.- Returns:
- the current context map.
-
addContextItem
Add an item to the context, or replace an existing item if an item with the given key already exists.- Parameters:
key- The key to store the item under.value- The value to associate with the given key.- Returns:
- this.
-
hasContextItem
Check if the context has an item for the given key.- Parameters:
key- the key to check.- Returns:
- true if there is a context item for the given key, false otherwise.
-
getContextItem
Get the context item with the given key, or dflt if there is no such item.- Parameters:
key- The key to get the item for.dflt- The value to return if there is no value for the given key.- Returns:
- The value for the given key, or dflt if there is no such item.
-
getContextItem
Get the context item with the given key, or null if there is no such item.- Parameters:
key- The key to get the item for.- Returns:
- The value for the given key, or null if there is no such item.
-
setContext
Replace the current context with the given value.- Parameters:
context- The context map to replace the current context with.- Returns:
- this
-
fromPrincipal
Turns the given principal into a PrincipalExtended. A null value will turn into an anonymous principal extended.- Parameters:
principal- the principal to check, or null.- Returns:
- A principalExtended.
-
getLocalPrincipal
-
setLocalPrincipal
-
removeLocalPrincipal
public static void removeLocalPrincipal()
-