1/* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18package java.security; 19 20 21/** 22 * {@code Principal}s are objects which have identities. These can be 23 * individuals, groups, corporations, unique program executions, etc. 24 */ 25public interface Principal { 26 /** 27 * Compares the specified object with this {@code Principal} for equality 28 * and returns {@code true} if the specified object is equal, {@code false} 29 * otherwise. 30 * 31 * @param obj 32 * object to be compared for equality with this {@code 33 * Principal}. 34 * @return {@code true} if the specified object is equal to this {@code 35 * Principal}, otherwise {@code false}. 36 */ 37 public boolean equals( Object obj ); 38 39 /** 40 * Returns the name of this {@code Principal}. 41 * 42 * @return the name of this {@code Principal}. 43 */ 44 public String getName(); 45 46 /** 47 * Returns the hash code value for this {@code Principal}. Returns the same 48 * hash code for {@code Principal}s that are equal to each other as 49 * required by the general contract of {@link Object#hashCode}. 50 * 51 * @return the hash code value for this {@code Principal}. 52 * @see Object#equals(Object) 53 * @see Principal#equals(Object) 54 */ 55 public int hashCode(); 56 57 /** 58 * Returns a string containing a concise, human-readable description of 59 * this {@code Principal}. 60 * 61 * @return a printable representation for this {@code Principal}. 62 */ 63 public String toString(); 64} 65