Class User


  • public final class User
    extends Object
    Represent an authenticating user for the Servlet container.
    • Constructor Detail

      • User

        public User()
    • Method Detail

      • setName

        public void setName​(String name)
        Parameters:
        name - the user name
      • getName

        public String getName()
        Returns:
        the user name
      • setPassword

        public void setPassword​(String password)
        Sets the authenticated user password.
        Parameters:
        password - the user password
      • getPassword

        public String getPassword()
        Returns:
        the user password
      • addRole

        public void addRole​(String role)
        Parameters:
        role - a role attached to this user
      • addRoles

        public void addRoles​(List<String> roles)
        Parameters:
        roles - a list of roles attached to this user
      • getRoles

        public List<String> getRoles()
        Returns:
        the list of roles attached to this user
      • equals

        public boolean equals​(Object userObject)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • parseUsers

        public static List<User> parseUsers​(String usersAsString)
        Parse a string representing the users (see ServletPropertySet.USERS.
        Parameters:
        usersAsString - the string representing the users
        Returns:
        a list of User objects
      • parseUser

        protected static User parseUser​(String userAsString)
        Parse a user defined in the format "name:pwd:role1,...roleN".
        Parameters:
        userAsString - the user defines as a string
        Returns:
        the parsed user
      • parseRoles

        protected static List<String> parseRoles​(String rolesAsString)
        Parse roles defined as a list in the format "role1,role2,...,roleN".
        Parameters:
        rolesAsString - the roles defined as a string
        Returns:
        the parsed list of roles
      • createRoleMap

        public static Map<String,​List<User>> createRoleMap​(List<User> users)
        Create a user map indexed on the roles.
        Parameters:
        users - list of User for which to extract roles from
        Returns:
        a map of roles containing users