001 package com.sptci.auth;
002
003 import java.util.Collection;
004 import java.util.HashSet;
005
006 /**
007 * A value object that represents a user object. This bean is used to
008 * store the values necessary to implement authentication and authorisation.
009 *
010 * <p>© Copyright 2006, Sans Pareil Technologies, Inc.</p>
011 * @author Rakesh Vidyadharan 2006-11-15
012 * @version $Id: User.java 3251 2007-05-12 19:09:12Z rakesh $
013 */
014 public class User
015 {
016 /**
017 * The userName of the user.
018 */
019 public final String userName;
020
021 /**
022 * The password of the user.
023 */
024 public final transient String password;
025
026 /**
027 * The collection of groups to which this user belongs.
028 */
029 public final Collection<Group> groups;
030
031 /**
032 * Create a new instance using the specified values.
033 *
034 * @param userName The {@link #userName} value to use.
035 * @param password The {@link #password} value to use.
036 * @param groups The {@link #groups} value to use.
037 */
038 public User( String userName, String password, Collection<Group> groups )
039 {
040 this.userName = userName;
041 this.password = password;
042 this.groups = ( ( groups == null ) ? new HashSet<Group>() : groups );
043 }
044 }