KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > osgi > service > useradmin > User


1 /*
2  * $Header: /cvshome/build/org.osgi.service.useradmin/src/org/osgi/service/useradmin/User.java,v 1.9 2006/07/11 00:54:01 hargrave Exp $
3  *
4  * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18 package org.osgi.service.useradmin;
19
20 import java.util.Dictionary JavaDoc;
21
22 /**
23  * A <code>User</code> role managed by a User Admin service.
24  *
25  * <p>
26  * In this context, the term &quot;user&quot; is not limited to just human
27  * beings. Instead, it refers to any entity that may have any number of
28  * credentials associated with it that it may use to authenticate itself.
29  * <p>
30  * In general, <code>User</code> objects are associated with a specific User Admin
31  * service (namely the one that created them), and cannot be used with other
32  * User Admin services.
33  * <p>
34  * A <code>User</code> object may have credentials (and properties, inherited from
35  * the {@link Role} class) associated with it. Specific
36  * {@link UserAdminPermission} objects are required to read or change a
37  * <code>User</code> object's credentials.
38  * <p>
39  * Credentials are <code>Dictionary</code> objects and have semantics that are
40  * similar to the properties in the <code>Role</code> class.
41  *
42  * @version $Revision: 1.9 $
43  */

44 public interface User extends Role {
45     /**
46      * Returns a <code>Dictionary</code> of the credentials of this <code>User</code>
47      * object. Any changes to the returned <code>Dictionary</code> object will
48      * change the credentials of this <code>User</code> object. This will cause a
49      * <code>UserAdminEvent</code> object of type
50      * {@link UserAdminEvent#ROLE_CHANGED} to be broadcast to any
51      * <code>UserAdminListeners</code> objects.
52      *
53      * <p>
54      * Only objects of type <code>String</code> may be used as credential keys,
55      * and only objects of type <code>String</code> or of type <code>byte[]</code>
56      * may be used as credential values. Any other types will cause an exception
57      * of type <code>IllegalArgumentException</code> to be raised.
58      *
59      * <p>
60      * In order to retrieve a credential from the returned <code>Dictionary</code>
61      * object, a {@link UserAdminPermission} named after the credential name (or
62      * a prefix of it) with action <code>getCredential</code> is required.
63      * <p>
64      * In order to add or remove a credential from the returned
65      * <code>Dictionary</code> object, a {@link UserAdminPermission} named after
66      * the credential name (or a prefix of it) with action
67      * <code>changeCredential</code> is required.
68      *
69      * @return <code>Dictionary</code> object containing the credentials of this
70      * <code>User</code> object.
71      */

72     public Dictionary JavaDoc getCredentials();
73
74     /**
75      * Checks to see if this <code>User</code> object has a credential with the
76      * specified <code>key</code> set to the specified <code>value</code>.
77      *
78      * <p>
79      * If the specified credential <code>value</code> is not of type
80      * <code>String</code> or <code>byte[]</code>, it is ignored, that is,
81      * <code>false</code> is returned (as opposed to an
82      * <code>IllegalArgumentException</code> being raised).
83      *
84      * @param key The credential <code>key</code>.
85      * @param value The credential <code>value</code>.
86      *
87      * @return <code>true</code> if this user has the specified credential;
88      * <code>false</code> otherwise.
89      *
90      * @throws SecurityException If a security manager exists and the caller
91      * does not have the <code>UserAdminPermission</code> named after the
92      * credential key (or a prefix of it) with action
93      * <code>getCredential</code>.
94      */

95     public boolean hasCredential(String JavaDoc key, Object JavaDoc value);
96 }
97
Popular Tags