1/*
2 * Copyright (c) 2003, 2007, Oracle and/or its affiliates. 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.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26package javax.management.remote;
27
28import java.security.BasicPermission;
29
30/**
31 * <p>Permission required by an authentication identity to perform
32 * operations on behalf of an authorization identity.</p>
33 *
34 * <p>A SubjectDelegationPermission contains a name (also referred
35 * to as a "target name") but no actions list; you either have the
36 * named permission or you don't.</p>
37 *
38 * <p>The target name is the name of the authorization principal
39 * classname followed by a period and the authorization principal
40 * name, that is
41 * <code>"<em>PrincipalClassName</em>.<em>PrincipalName</em>"</code>.</p>
42 *
43 * <p>An asterisk may appear by itself, or if immediately preceded
44 * by a "." may appear at the end of the target name, to signify a
45 * wildcard match.</p>
46 *
47 * <p>For example, "*", "javax.management.remote.JMXPrincipal.*" and
48 * "javax.management.remote.JMXPrincipal.delegate" are valid target
49 * names. The first one denotes any principal name from any principal
50 * class, the second one denotes any principal name of the concrete
51 * principal class <code>javax.management.remote.JMXPrincipal</code>
52 * and the third one denotes a concrete principal name
53 * <code>delegate</code> of the concrete principal class
54 * <code>javax.management.remote.JMXPrincipal</code>.</p>
55 *
56 * @since 1.5
57 */
58public final class SubjectDelegationPermission extends BasicPermission {
59
60    private static final long serialVersionUID = 1481618113008682343L;
61
62    /**
63     * Creates a new SubjectDelegationPermission with the specified name.
64     * The name is the symbolic name of the SubjectDelegationPermission.
65     *
66     * @param name the name of the SubjectDelegationPermission
67     *
68     * @throws NullPointerException if <code>name</code> is
69     * <code>null</code>.
70     * @throws IllegalArgumentException if <code>name</code> is empty.
71     */
72    public SubjectDelegationPermission(String name) {
73        super(name);
74    }
75
76    /**
77     * Creates a new SubjectDelegationPermission object with the
78     * specified name.  The name is the symbolic name of the
79     * SubjectDelegationPermission, and the actions String is
80     * currently unused and must be null.
81     *
82     * @param name the name of the SubjectDelegationPermission
83     * @param actions must be null.
84     *
85     * @throws NullPointerException if <code>name</code> is
86     * <code>null</code>.
87     * @throws IllegalArgumentException if <code>name</code> is empty
88     * or <code>actions</code> is not null.
89     */
90    public SubjectDelegationPermission(String name, String actions) {
91        super(name, actions);
92
93        if (actions != null)
94            throw new IllegalArgumentException("Non-null actions");
95    }
96}
97