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