java.lang.Object
com.ibm.security.access.extension.authn.credential.Credential
All Implemented Interfaces:
Serializable

public class Credential extends Object implements Serializable
This class represents a user credential. Credential consists of a username, a group set, and an attribute set.
See Also:
  • Constructor Details

    • Credential

      public Credential(String username)
      Create a user credential with the specified username. The group set and the attribute set are empty.
      Parameters:
      username - The username.
    • Credential

      public Credential(String username, Set<Group> groups, Set<Attribute> attributes)
      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

      public String getUsername()
      Get the username.
      Returns:
      The username.
    • getGroups

      public Set<Group> getGroups()
      Get the group set. If the returned group set is modified, call the method setGroups(Set) to persist the modifications.
      Returns:
      The group set.
    • setGroups

      public void setGroups(Set<Group> groups)
      Set the group set.
      Parameters:
      groups - The group set.
    • getGroup

      public Group getGroup(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(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(String name)
      Remove the group with the specified name from the group set.
      Parameters:
      name - The name.
    • getAttributes

      public Set<Attribute> getAttributes()
      Get the attribute set. If the returned attribute set is modified, call the method setAttributes(Set) to persist the modifications.
      Returns:
      The attribute set.
    • setAttributes

      public void setAttributes(Set<Attribute> attributes)
      Set the attribute set.
      Parameters:
      attributes - The attribute set.
    • getAttribute

      public Attribute getAttribute(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(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(String name)
      Remove the attribute with the specified name from the attribute set.
      Parameters:
      name - The name.