J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2003-2007 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package javax.management.remote; |
| 27 | |
| 28 | import java.security.Principal; |
| 29 | import javax.security.auth.Subject; |
| 30 | |
| 31 | /** |
| 32 | * <p>Interface to define how remote credentials are converted into a |
| 33 | * JAAS Subject. This interface is used by the RMI Connector Server, |
| 34 | * and can be used by other connector servers.</p> |
| 35 | * |
| 36 | * <p>The user-defined authenticator instance is passed to the |
| 37 | * connector server in the environment map as the value of the |
| 38 | * attribute {@link JMXConnectorServer#AUTHENTICATOR}. For connector |
| 39 | * servers that use only this authentication system, if this attribute |
| 40 | * is not present or its value is <code>null</code> then no user |
| 41 | * authentication will be performed and full access to the methods |
| 42 | * exported by the <code>MBeanServerConnection</code> object will be |
| 43 | * allowed.</p> |
| 44 | * |
| 45 | * <p>If authentication is successful then an authenticated |
| 46 | * {@link Subject subject} filled in with its associated |
| 47 | * {@link Principal principals} is returned. Authorization checks |
| 48 | * will be then performed based on the given set of principals.</p> |
| 49 | * |
| 50 | * @since 1.5 |
| 51 | */ |
| 52 | public interface JMXAuthenticator { |
| 53 | |
| 54 | /** |
| 55 | * <p>Authenticates the <code>MBeanServerConnection</code> client |
| 56 | * with the given client credentials.</p> |
| 57 | * |
| 58 | * @param credentials the user-defined credentials to be passed |
| 59 | * into the server in order to authenticate the user before |
| 60 | * creating the <code>MBeanServerConnection</code>. The actual |
| 61 | * type of this parameter, and whether it can be null, depends on |
| 62 | * the connector. |
| 63 | * |
| 64 | * @return the authenticated subject containing its associated principals. |
| 65 | * |
| 66 | * @exception SecurityException if the server cannot authenticate the user |
| 67 | * with the provided credentials. |
| 68 | */ |
| 69 | public Subject authenticate(Object credentials); |
| 70 | } |