1. /*
  2. * @(#)AuthPermission.java 1.48 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.security.auth;
  8. /**
  9. * This class is for authentication permissions.
  10. * An AuthPermission contains a name
  11. * (also referred to as a "target name")
  12. * but no actions list; you either have the named permission
  13. * or you don't.
  14. *
  15. * <p> The target name is the name of a security configuration parameter
  16. * (see below). Currently the AuthPermission object is used to
  17. * guard access to the Policy, Subject, LoginContext,
  18. * and Configuration objects.
  19. *
  20. * <p> The possible target names for an Authentication Permission are:
  21. *
  22. * <pre>
  23. * doAs - allow the caller to invoke the
  24. * <code>Subject.doAs</code> methods.
  25. *
  26. * doAsPrivileged - allow the caller to invoke the
  27. * <code>Subject.doAsPrivileged</code> methods.
  28. *
  29. * getSubject - allow for the retrieval of the
  30. * Subject(s) associated with the
  31. * current Thread.
  32. *
  33. * getSubjectFromDomainCombiner - allow for the retrieval of the
  34. * Subject associated with the
  35. * a <code>SubjectDomainCombiner</code>.
  36. *
  37. * setReadOnly - allow the caller to set a Subject
  38. * to be read-only.
  39. *
  40. * modifyPrincipals - allow the caller to modify the <code>Set</code>
  41. * of Principals associated with a
  42. * <code>Subject</code>
  43. *
  44. * modifyPublicCredentials - allow the caller to modify the
  45. * <code>Set</code> of public credentials
  46. * associated with a <code>Subject</code>
  47. *
  48. * modifyPrivateCredentials - allow the caller to modify the
  49. * <code>Set</code> of private credentials
  50. * associated with a <code>Subject</code>
  51. *
  52. * refreshCredential - allow code to invoke the <code>refresh</code>
  53. * method on a credential which implements
  54. * the <code>Refreshable</code> interface.
  55. *
  56. * destroyCredential - allow code to invoke the <code>destroy</code>
  57. * method on a credential <code>object</code>
  58. * which implements the <code>Destroyable</code>
  59. * interface.
  60. *
  61. * createLoginContext.{name} - allow code to instantiate a
  62. * <code>LoginContext</code> with the
  63. * specified <i>name</i>. <i>name</i>
  64. * is used as the index into the login
  65. * <code>Configuration</code>. <i>name</i>
  66. * can be wildcarded (set to '*') to allow
  67. * for any name.
  68. *
  69. * getLoginConfiguration - allow for the retrieval of the system-wide
  70. * login Configuration.
  71. *
  72. * setLoginConfiguration - allow for the setting of the system-wide
  73. * login Configuration.
  74. *
  75. * refreshLoginConfiguration - allow for the refreshing of the system-wide
  76. * login Configuration.
  77. * </pre>
  78. *
  79. * <p> The following target name has been deprecated in favor of
  80. * <code>createLoginContext.{name}</code>.
  81. *
  82. * <pre>
  83. * createLoginContext - allow code to instantiate a
  84. * <code>LoginContext</code>.
  85. * </pre>
  86. *
  87. * <p> <code>javax.security.auth.Policy</code> has been
  88. * deprecated in favor of <code>java.security.Policy</code>.
  89. * Therefore, the following target names have also been deprecated:
  90. *
  91. * <pre>
  92. * getPolicy - allow the caller to retrieve the system-wide
  93. * Subject-based access control policy.
  94. *
  95. * setPolicy - allow the caller to set the system-wide
  96. * Subject-based access control policy.
  97. *
  98. * refreshPolicy - allow the caller to refresh the system-wide
  99. * Subject-based access control policy.
  100. * </pre>
  101. *
  102. * @version 1.48, 01/23/03
  103. */
  104. public final class AuthPermission extends
  105. java.security.BasicPermission {
  106. /**
  107. * Creates a new AuthPermission with the specified name.
  108. * The name is the symbolic name of the AuthPermission.
  109. *
  110. * <p>
  111. *
  112. * @param name the name of the AuthPermission
  113. */
  114. public AuthPermission(String name) {
  115. // for backwards compatibility --
  116. // createLoginContext is deprecated in favor of createLoginContext.*
  117. super("createLoginContext".equals(name) ?
  118. "createLoginContext.*" : name);
  119. }
  120. /**
  121. * Creates a new AuthPermission object with the specified name.
  122. * The name is the symbolic name of the AuthPermission, and the
  123. * actions String is currently unused and should be null.
  124. *
  125. * <p>
  126. *
  127. * @param name the name of the AuthPermission <p>
  128. *
  129. * @param actions should be null.
  130. */
  131. public AuthPermission(String name, String actions) {
  132. // for backwards compatibility --
  133. // createLoginContext is deprecated in favor of createLoginContext.*
  134. super("createLoginContext".equals(name) ?
  135. "createLoginContext.*" : name, actions);
  136. }
  137. }