Class Credential
java.lang.Object
com.ibm.security.access.extension.authn.credential.Credential
- All Implemented Interfaces:
Serializable
This class represents a user credential. Credential consists of a username, a
group set, and an attribute set.
- See Also:
-
Constructor Summary
ConstructorDescriptionCredential
(String username) Create a user credential with the specified username.Create a user credential with the specified username, group set, and attribute set. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttribute
(Attribute attribute) Add the specified attribute to the attribute set.void
Add the specified group to the group set.getAttribute
(String name) Get the attribute with the specified name from the attribute set.Get the attribute set.Get the group with the specified name.Get the group set.Get the username.boolean
hasAttribute
(String name) Check whether there is an attribute with the specified name in the attribute set.boolean
Check whether there is a group with the specified name in the group set.void
removeAttribute
(String name) Remove the attribute with the specified name from the attribute set.void
removeGroup
(String name) Remove the group with the specified name from the group set.void
setAttributes
(Set<Attribute> attributes) Set the attribute set.void
Set the group set.
-
Constructor Details
-
Credential
Create a user credential with the specified username. The group set and the attribute set are empty.- Parameters:
username
- The username.
-
Credential
Create a user credential with the specified username, group set, and attribute set.- Parameters:
username
- The username.groups
- The group set.attributes
- The attribute set.
-
-
Method Details
-
getUsername
Get the username.- Returns:
- The username.
-
getGroups
Get the group set. If the returned group set is modified, call the methodsetGroups(Set)
to persist the modifications.- Returns:
- The group set.
-
setGroups
Set the group set.- Parameters:
groups
- The group set.
-
getGroup
Get the group with the specified name.- Parameters:
name
- The name.- Returns:
- The group.
-
addGroup
Add the specified group to the group set. If the group set already contains a group whose name is equal to the name of the specified group, the existing group is replaced with the specified group.- Parameters:
group
- The group.
-
hasGroup
Check whether there is a group with the specified name in the group set.- Parameters:
name
- The name.- Returns:
- Whether there is a group with the specified name in the group set.
-
removeGroup
Remove the group with the specified name from the group set.- Parameters:
name
- The name.
-
getAttributes
Get the attribute set. If the returned attribute set is modified, call the methodsetAttributes(Set)
to persist the modifications.- Returns:
- The attribute set.
-
setAttributes
Set the attribute set.- Parameters:
attributes
- The attribute set.
-
getAttribute
Get the attribute with the specified name from the attribute set.- Parameters:
name
- The name.- Returns:
- The attribute.
-
addAttribute
Add the specified attribute to the attribute set. If the attribute set already contains an attribute whose name is equal to the name of the specified attribute, the existing attribute is replaced with the specified attribute.- Parameters:
attribute
- The attribute.
-
hasAttribute
Check whether there is an attribute with the specified name in the attribute set.- Parameters:
name
- The name.- Returns:
- Whether there is an attribute with the specified name in the attribute set.
-
removeAttribute
Remove the attribute with the specified name from the attribute set.- Parameters:
name
- The name.
-