--- /dev/null
+// PrincipalImpl.java\r
+// $Id: PrincipalImpl.java,v 1.1 2010/06/15 12:24:11 smhuang Exp $\r
+// (c) COPYRIGHT MIT, INRIA and Keio, 1999.\r
+// Please first read the full copyright statement in file COPYRIGHT.html\r
+package org.w3c.jigsaw.servlet;\r
+\r
+import java.security.Principal;\r
+\r
+/**\r
+ * @version $Revision: 1.1 $\r
+ * @author Benoît Mahé (bmahe@w3.org)\r
+ */\r
+public class PrincipalImpl implements Principal {\r
+\r
+ protected String name;\r
+\r
+ /**\r
+ * Compares this principal to the specified object. Returns true\r
+ * if the object passed in matches the principal represented by\r
+ * the implementation of this interface.\r
+ *\r
+ * @param another principal to compare with.\r
+ *\r
+ * @return true if the principal passed in is the same as that\r
+ * encapsulated by this principal, and false otherwise.\r
+ */\r
+ public boolean equals(Object another) {\r
+ return ((Principal)another).getName().equalsIgnoreCase(name);\r
+ }\r
+\r
+ /**\r
+ * Returns a string representation of this principal.\r
+ *\r
+ * @return a string representation of this principal.\r
+ */\r
+ public String toString() {\r
+ return name;\r
+ }\r
+\r
+ /**\r
+ * Returns a hashcode for this principal.\r
+ *\r
+ * @return a hashcode for this principal.\r
+ */\r
+ public int hashCode() {\r
+ return name.hashCode();\r
+ }\r
+\r
+ /**\r
+ * Returns the name of this principal.\r
+ *\r
+ * @return the name of this principal.\r
+ */\r
+ public String getName() {\r
+ return name;\r
+ }\r
+\r
+ public PrincipalImpl(String name) {\r
+ this.name = name;\r
+ }\r
+\r
+}\r