1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 package com.sun.enterprise.security.auth.realm; 24 25 import java.security.Principal; 26 27 import java.util.Enumeration; 28 29 30 /** 31 * All users are principals ... perhaps in the native OS, perhaps 32 * not. 33 * 34 * <P> Users always have authentication information, which is used 35 * to validate a user's proferred credentials. Different kinds of 36 * realms use different kinds of authentication information. For 37 * example, realms could use X.509 public key certificates, shared 38 * passphrases, encrypted passwords, smart cards, or biometric data 39 * to figure out if the user's credentials are valid. 40 * 41 * <P> Users typically have attributes that identify privileges 42 * granted/possesed by the user. 43 * 44 * @author Harish Prabandham 45 */ 46 47 public interface User extends Principal { 48 /** 49 * Returns the realm with which this user is associated. 50 */ 51 Realm getRealm () throws NoSuchRealmException; 52 53 54 /** 55 * Returns the single requested attribute for the user. 56 * 57 * @param name string identifying the attribute. 58 * @return value of that attribute, or null if no value 59 * has been defined 60 */ 61 Object getAttribute (String name); 62 63 64 /** 65 * Returns an enumeration of the keys for the attributes 66 * supported for this user. 67 */ 68 Enumeration getAttributeNames (); 69 } 70