01: // ========================================================================
02: // $Id: JAASPrincipal.java 305 2006-03-07 10:32:14Z janb $
03: // Copyright 2002-2004 Mort Bay Consulting Pty. Ltd.
04: // ------------------------------------------------------------------------
05: // Licensed under the Apache License, Version 2.0 (the "License");
06: // you may not use this file except in compliance with the License.
07: // You may obtain a copy of the License at
08: // http://www.apache.org/licenses/LICENSE-2.0
09: // Unless required by applicable law or agreed to in writing, software
10: // distributed under the License is distributed on an "AS IS" BASIS,
11: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: // See the License for the specific language governing permissions and
13: // limitations under the License.
14: // ========================================================================
15:
16: package org.mortbay.jetty.plus.jaas;
17:
18: import java.io.Serializable;
19: import java.security.Principal;
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: * @author Jan Bartel (janb)
37: */
38: public class JAASPrincipal implements Principal, Serializable {
39: private String name = null;
40:
41: public JAASPrincipal(String userName) {
42: this .name = userName;
43: }
44:
45: public boolean equals(Object p) {
46: if (!(p instanceof JAASPrincipal))
47: return false;
48:
49: return getName().equals(((JAASPrincipal) p).getName());
50: }
51:
52: public int hashCode() {
53: return getName().hashCode();
54: }
55:
56: public String getName() {
57: return this .name;
58: }
59:
60: public String toString() {
61: return getName();
62: }
63:
64: }
|