Class Credential
- java.lang.Object
-
- com.ibm.security.access.extension.authn.credential.Credential
-
- All Implemented Interfaces:
java.io.Serializable
public class Credential extends java.lang.Object implements java.io.Serializable
This class represents a user credential. Credential consists of a username, a group set, and an attribute set.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Credential(java.lang.String username)
Create a user credential with the specified username.Credential(java.lang.String username, java.util.Set<Group> groups, java.util.Set<Attribute> attributes)
Create a user credential with the specified username, group set, and attribute set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(Attribute attribute)
Add the specified attribute to the attribute set.void
addGroup(Group group)
Add the specified group to the group set.Attribute
getAttribute(java.lang.String name)
Get the attribute with the specified name from the attribute set.java.util.Set<Attribute>
getAttributes()
Get the attribute set.Group
getGroup(java.lang.String name)
Get the group with the specified name.java.util.Set<Group>
getGroups()
Get the group set.java.lang.String
getUsername()
Get the username.boolean
hasAttribute(java.lang.String name)
Check whether there is an attribute with the specified name in the attribute set.boolean
hasGroup(java.lang.String name)
Check whether there is a group with the specified name in the group set.void
removeAttribute(java.lang.String name)
Remove the attribute with the specified name from the attribute set.void
removeGroup(java.lang.String name)
Remove the group with the specified name from the group set.void
setAttributes(java.util.Set<Attribute> attributes)
Set the attribute set.void
setGroups(java.util.Set<Group> groups)
Set the group set.
-
-
-
Method Detail
-
getUsername
public java.lang.String getUsername()
Get the username.- Returns:
- The username.
-
getGroups
public java.util.Set<Group> 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
public void setGroups(java.util.Set<Group> groups)
Set the group set.- Parameters:
groups
- The group set.
-
getGroup
public Group getGroup(java.lang.String name)
Get the group with the specified name.- Parameters:
name
- The name.- Returns:
- The group.
-
addGroup
public void addGroup(Group group)
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
public boolean hasGroup(java.lang.String name)
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
public void removeGroup(java.lang.String name)
Remove the group with the specified name from the group set.- Parameters:
name
- The name.
-
getAttributes
public java.util.Set<Attribute> 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
public void setAttributes(java.util.Set<Attribute> attributes)
Set the attribute set.- Parameters:
attributes
- The attribute set.
-
getAttribute
public Attribute getAttribute(java.lang.String name)
Get the attribute with the specified name from the attribute set.- Parameters:
name
- The name.- Returns:
- The attribute.
-
addAttribute
public void addAttribute(Attribute attribute)
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
public boolean hasAttribute(java.lang.String name)
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
public void removeAttribute(java.lang.String name)
Remove the attribute with the specified name from the attribute set.- Parameters:
name
- The name.
-
-