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 /** 41 * 42 */ 43 private static final long serialVersionUID = -5538962177019315479L; 44 45 private String _name = null; 46 47 48 public JAASPrincipal(String userName) 49 { 50 this._name = userName; 51 } 52 53 54 public boolean equals (Object p) 55 { 56 if (! (p instanceof JAASPrincipal)) 57 return false; 58 59 return getName().equals(((JAASPrincipal)p).getName()); 60 } 61 62 63 public int hashCode () 64 { 65 return getName().hashCode(); 66 } 67 68 69 public String getName () 70 { 71 return this._name; 72 } 73 74 75 public String toString () 76 { 77 return getName(); 78 } 79 80 81 82 } 83 84