0N/A/*
2362N/A * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.security.auth;
0N/A
0N/A/**
0N/A * This class is for authentication permissions.
0N/A * An AuthPermission contains a name
0N/A * (also referred to as a "target name")
0N/A * but no actions list; you either have the named permission
0N/A * or you don't.
0N/A *
0N/A * <p> The target name is the name of a security configuration parameter
0N/A * (see below). Currently the AuthPermission object is used to
0N/A * guard access to the Policy, Subject, LoginContext,
0N/A * and Configuration objects.
0N/A *
0N/A * <p> The possible target names for an Authentication Permission are:
0N/A *
0N/A * <pre>
0N/A * doAs - allow the caller to invoke the
0N/A * <code>Subject.doAs</code> methods.
0N/A *
0N/A * doAsPrivileged - allow the caller to invoke the
0N/A * <code>Subject.doAsPrivileged</code> methods.
0N/A *
0N/A * getSubject - allow for the retrieval of the
0N/A * Subject(s) associated with the
0N/A * current Thread.
0N/A *
0N/A * getSubjectFromDomainCombiner - allow for the retrieval of the
0N/A * Subject associated with the
0N/A * a <code>SubjectDomainCombiner</code>.
0N/A *
0N/A * setReadOnly - allow the caller to set a Subject
0N/A * to be read-only.
0N/A *
0N/A * modifyPrincipals - allow the caller to modify the <code>Set</code>
0N/A * of Principals associated with a
0N/A * <code>Subject</code>
0N/A *
0N/A * modifyPublicCredentials - allow the caller to modify the
0N/A * <code>Set</code> of public credentials
0N/A * associated with a <code>Subject</code>
0N/A *
0N/A * modifyPrivateCredentials - allow the caller to modify the
0N/A * <code>Set</code> of private credentials
0N/A * associated with a <code>Subject</code>
0N/A *
0N/A * refreshCredential - allow code to invoke the <code>refresh</code>
0N/A * method on a credential which implements
0N/A * the <code>Refreshable</code> interface.
0N/A *
0N/A * destroyCredential - allow code to invoke the <code>destroy</code>
0N/A * method on a credential <code>object</code>
0N/A * which implements the <code>Destroyable</code>
0N/A * interface.
0N/A *
0N/A * createLoginContext.{name} - allow code to instantiate a
0N/A * <code>LoginContext</code> with the
0N/A * specified <i>name</i>. <i>name</i>
0N/A * is used as the index into the installed login
0N/A * <code>Configuration</code>
0N/A * (that returned by
0N/A * <code>Configuration.getConfiguration()</code>).
0N/A * <i>name</i> can be wildcarded (set to '*')
0N/A * to allow for any name.
0N/A *
0N/A * getLoginConfiguration - allow for the retrieval of the system-wide
0N/A * login Configuration.
0N/A *
0N/A * createLoginConfiguration.{type} - allow code to obtain a Configuration
0N/A * object via
0N/A * <code>Configuration.getInstance</code>.
0N/A *
0N/A * setLoginConfiguration - allow for the setting of the system-wide
0N/A * login Configuration.
0N/A *
0N/A * refreshLoginConfiguration - allow for the refreshing of the system-wide
0N/A * login Configuration.
0N/A * </pre>
0N/A *
0N/A * <p> The following target name has been deprecated in favor of
0N/A * <code>createLoginContext.{name}</code>.
0N/A *
0N/A * <pre>
0N/A * createLoginContext - allow code to instantiate a
0N/A * <code>LoginContext</code>.
0N/A * </pre>
0N/A *
0N/A * <p> <code>javax.security.auth.Policy</code> has been
0N/A * deprecated in favor of <code>java.security.Policy</code>.
0N/A * Therefore, the following target names have also been deprecated:
0N/A *
0N/A * <pre>
0N/A * getPolicy - allow the caller to retrieve the system-wide
0N/A * Subject-based access control policy.
0N/A *
0N/A * setPolicy - allow the caller to set the system-wide
0N/A * Subject-based access control policy.
0N/A *
0N/A * refreshPolicy - allow the caller to refresh the system-wide
0N/A * Subject-based access control policy.
0N/A * </pre>
0N/A *
0N/A */
0N/Apublic final class AuthPermission extends
0N/Ajava.security.BasicPermission {
0N/A
0N/A private static final long serialVersionUID = 5806031445061587174L;
0N/A
0N/A /**
0N/A * Creates a new AuthPermission with the specified name.
0N/A * The name is the symbolic name of the AuthPermission.
0N/A *
0N/A * <p>
0N/A *
0N/A * @param name the name of the AuthPermission
0N/A *
0N/A * @throws NullPointerException if <code>name</code> is <code>null</code>.
0N/A * @throws IllegalArgumentException if <code>name</code> is empty.
0N/A */
0N/A public AuthPermission(String name) {
0N/A // for backwards compatibility --
0N/A // createLoginContext is deprecated in favor of createLoginContext.*
0N/A super("createLoginContext".equals(name) ?
0N/A "createLoginContext.*" : name);
0N/A }
0N/A
0N/A /**
0N/A * Creates a new AuthPermission object with the specified name.
0N/A * The name is the symbolic name of the AuthPermission, and the
0N/A * actions String is currently unused and should be null.
0N/A *
0N/A * <p>
0N/A *
0N/A * @param name the name of the AuthPermission <p>
0N/A *
0N/A * @param actions should be null.
0N/A *
0N/A * @throws NullPointerException if <code>name</code> is <code>null</code>.
0N/A * @throws IllegalArgumentException if <code>name</code> is empty.
0N/A */
0N/A public AuthPermission(String name, String actions) {
0N/A // for backwards compatibility --
0N/A // createLoginContext is deprecated in favor of createLoginContext.*
0N/A super("createLoginContext".equals(name) ?
0N/A "createLoginContext.*" : name, actions);
0N/A }
0N/A}