1 // ========================================================================
2 // Copyright (c) 2002-2009 Mort Bay Consulting Pty. Ltd.
3 // ------------------------------------------------------------------------
4 // All rights reserved. This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v1.0
6 // and Apache License v2.0 which accompanies this distribution.
7 // The Eclipse Public License is available at
8 // http://www.eclipse.org/legal/epl-v10.html
9 // The Apache License v2.0 is available at
10 // http://www.opensource.org/licenses/apache2.0.php
11 // You may elect to redistribute this code under either of these licenses.
12 // ========================================================================
13
14 package org.eclipse.jetty.plus.jaas;
15
16 import java.io.Serializable;
17 import java.security.Principal;
18
19
20
21 /* ---------------------------------------------------- */
22 /** JAASPrincipal
23 * <p>Impl class of Principal interface.
24 *
25 * <p><h4>Notes</h4>
26 * <p>
27 *
28 * <p><h4>Usage</h4>
29 * <pre>
30 */
31 /*
32 * </pre>
33 *
34 * @see
35 * @version 1.0 Tue Apr 15 2003
36 *
37 */
38 public class JAASPrincipal implements Principal, Serializable
39 {
40 private String _name = null;
41
42
43 public JAASPrincipal(String userName)
44 {
45 this._name = userName;
46 }
47
48
49 public boolean equals (Object p)
50 {
51 if (! (p instanceof JAASPrincipal))
52 return false;
53
54 return getName().equals(((JAASPrincipal)p).getName());
55 }
56
57
58 public int hashCode ()
59 {
60 return getName().hashCode();
61 }
62
63
64 public String getName ()
65 {
66 return this._name;
67 }
68
69
70 public String toString ()
71 {
72 return getName();
73 }
74
75
76
77 }
78
79