jdk/src/share/classes/javax/security/auth/AuthPermission.java
changeset 18830 90956ead732f
parent 5506 202f599c92aa
equal deleted inserted replaced
18829:ec84f0c313b0 18830:90956ead732f
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    39  *
    39  *
    40  * <p> The possible target names for an Authentication Permission are:
    40  * <p> The possible target names for an Authentication Permission are:
    41  *
    41  *
    42  * <pre>
    42  * <pre>
    43  *      doAs -                  allow the caller to invoke the
    43  *      doAs -                  allow the caller to invoke the
    44  *                              <code>Subject.doAs</code> methods.
    44  *                              {@code Subject.doAs} methods.
    45  *
    45  *
    46  *      doAsPrivileged -        allow the caller to invoke the
    46  *      doAsPrivileged -        allow the caller to invoke the
    47  *                              <code>Subject.doAsPrivileged</code> methods.
    47  *                              {@code Subject.doAsPrivileged} methods.
    48  *
    48  *
    49  *      getSubject -            allow for the retrieval of the
    49  *      getSubject -            allow for the retrieval of the
    50  *                              Subject(s) associated with the
    50  *                              Subject(s) associated with the
    51  *                              current Thread.
    51  *                              current Thread.
    52  *
    52  *
    53  *      getSubjectFromDomainCombiner -  allow for the retrieval of the
    53  *      getSubjectFromDomainCombiner -  allow for the retrieval of the
    54  *                              Subject associated with the
    54  *                              Subject associated with the
    55  *                              a <code>SubjectDomainCombiner</code>.
    55  *                              a {@code SubjectDomainCombiner}.
    56  *
    56  *
    57  *      setReadOnly -           allow the caller to set a Subject
    57  *      setReadOnly -           allow the caller to set a Subject
    58  *                              to be read-only.
    58  *                              to be read-only.
    59  *
    59  *
    60  *      modifyPrincipals -      allow the caller to modify the <code>Set</code>
    60  *      modifyPrincipals -      allow the caller to modify the {@code Set}
    61  *                              of Principals associated with a
    61  *                              of Principals associated with a
    62  *                              <code>Subject</code>
    62  *                              {@code Subject}
    63  *
    63  *
    64  *      modifyPublicCredentials - allow the caller to modify the
    64  *      modifyPublicCredentials - allow the caller to modify the
    65  *                              <code>Set</code> of public credentials
    65  *                              {@code Set} of public credentials
    66  *                              associated with a <code>Subject</code>
    66  *                              associated with a {@code Subject}
    67  *
    67  *
    68  *      modifyPrivateCredentials - allow the caller to modify the
    68  *      modifyPrivateCredentials - allow the caller to modify the
    69  *                              <code>Set</code> of private credentials
    69  *                              {@code Set} of private credentials
    70  *                              associated with a <code>Subject</code>
    70  *                              associated with a {@code Subject}
    71  *
    71  *
    72  *      refreshCredential -     allow code to invoke the <code>refresh</code>
    72  *      refreshCredential -     allow code to invoke the {@code refresh}
    73  *                              method on a credential which implements
    73  *                              method on a credential which implements
    74  *                              the <code>Refreshable</code> interface.
    74  *                              the {@code Refreshable} interface.
    75  *
    75  *
    76  *      destroyCredential -     allow code to invoke the <code>destroy</code>
    76  *      destroyCredential -     allow code to invoke the {@code destroy}
    77  *                              method on a credential <code>object</code>
    77  *                              method on a credential {@code object}
    78  *                              which implements the <code>Destroyable</code>
    78  *                              which implements the {@code Destroyable}
    79  *                              interface.
    79  *                              interface.
    80  *
    80  *
    81  *      createLoginContext.{name} -  allow code to instantiate a
    81  *      createLoginContext.{name} -  allow code to instantiate a
    82  *                              <code>LoginContext</code> with the
    82  *                              {@code LoginContext} with the
    83  *                              specified <i>name</i>.  <i>name</i>
    83  *                              specified <i>name</i>.  <i>name</i>
    84  *                              is used as the index into the installed login
    84  *                              is used as the index into the installed login
    85  *                              <code>Configuration</code>
    85  *                              {@code Configuration}
    86  *                              (that returned by
    86  *                              (that returned by
    87  *                              <code>Configuration.getConfiguration()</code>).
    87  *                              {@code Configuration.getConfiguration()}).
    88  *                              <i>name</i> can be wildcarded (set to '*')
    88  *                              <i>name</i> can be wildcarded (set to '*')
    89  *                              to allow for any name.
    89  *                              to allow for any name.
    90  *
    90  *
    91  *      getLoginConfiguration - allow for the retrieval of the system-wide
    91  *      getLoginConfiguration - allow for the retrieval of the system-wide
    92  *                              login Configuration.
    92  *                              login Configuration.
    93  *
    93  *
    94  *      createLoginConfiguration.{type} - allow code to obtain a Configuration
    94  *      createLoginConfiguration.{type} - allow code to obtain a Configuration
    95  *                              object via
    95  *                              object via
    96  *                              <code>Configuration.getInstance</code>.
    96  *                              {@code Configuration.getInstance}.
    97  *
    97  *
    98  *      setLoginConfiguration - allow for the setting of the system-wide
    98  *      setLoginConfiguration - allow for the setting of the system-wide
    99  *                              login Configuration.
    99  *                              login Configuration.
   100  *
   100  *
   101  *      refreshLoginConfiguration - allow for the refreshing of the system-wide
   101  *      refreshLoginConfiguration - allow for the refreshing of the system-wide
   102  *                              login Configuration.
   102  *                              login Configuration.
   103  * </pre>
   103  * </pre>
   104  *
   104  *
   105  * <p> The following target name has been deprecated in favor of
   105  * <p> The following target name has been deprecated in favor of
   106  * <code>createLoginContext.{name}</code>.
   106  * {@code createLoginContext.{name}}.
   107  *
   107  *
   108  * <pre>
   108  * <pre>
   109  *      createLoginContext -    allow code to instantiate a
   109  *      createLoginContext -    allow code to instantiate a
   110  *                              <code>LoginContext</code>.
   110  *                              {@code LoginContext}.
   111  * </pre>
   111  * </pre>
   112  *
   112  *
   113  * <p> <code>javax.security.auth.Policy</code> has been
   113  * <p> {@code javax.security.auth.Policy} has been
   114  * deprecated in favor of <code>java.security.Policy</code>.
   114  * deprecated in favor of {@code java.security.Policy}.
   115  * Therefore, the following target names have also been deprecated:
   115  * Therefore, the following target names have also been deprecated:
   116  *
   116  *
   117  * <pre>
   117  * <pre>
   118  *      getPolicy -             allow the caller to retrieve the system-wide
   118  *      getPolicy -             allow the caller to retrieve the system-wide
   119  *                              Subject-based access control policy.
   119  *                              Subject-based access control policy.
   137      *
   137      *
   138      * <p>
   138      * <p>
   139      *
   139      *
   140      * @param name the name of the AuthPermission
   140      * @param name the name of the AuthPermission
   141      *
   141      *
   142      * @throws NullPointerException if <code>name</code> is <code>null</code>.
   142      * @throws NullPointerException if {@code name} is {@code null}.
   143      * @throws IllegalArgumentException if <code>name</code> is empty.
   143      * @throws IllegalArgumentException if {@code name} is empty.
   144      */
   144      */
   145     public AuthPermission(String name) {
   145     public AuthPermission(String name) {
   146         // for backwards compatibility --
   146         // for backwards compatibility --
   147         // createLoginContext is deprecated in favor of createLoginContext.*
   147         // createLoginContext is deprecated in favor of createLoginContext.*
   148         super("createLoginContext".equals(name) ?
   148         super("createLoginContext".equals(name) ?
   158      *
   158      *
   159      * @param name the name of the AuthPermission <p>
   159      * @param name the name of the AuthPermission <p>
   160      *
   160      *
   161      * @param actions should be null.
   161      * @param actions should be null.
   162      *
   162      *
   163      * @throws NullPointerException if <code>name</code> is <code>null</code>.
   163      * @throws NullPointerException if {@code name} is {@code null}.
   164      * @throws IllegalArgumentException if <code>name</code> is empty.
   164      * @throws IllegalArgumentException if {@code name} is empty.
   165      */
   165      */
   166     public AuthPermission(String name, String actions) {
   166     public AuthPermission(String name, String actions) {
   167         // for backwards compatibility --
   167         // for backwards compatibility --
   168         // createLoginContext is deprecated in favor of createLoginContext.*
   168         // createLoginContext is deprecated in favor of createLoginContext.*
   169         super("createLoginContext".equals(name) ?
   169         super("createLoginContext".equals(name) ?