jdk/src/java.base/share/classes/javax/net/ssl/SSLPermission.java
author jjg
Thu, 11 May 2017 10:48:00 -0700
changeset 45124 144479e89cdb
parent 25859 3317bb8137f4
child 45881 aaec0fbe17ae
permissions -rw-r--r--
8179592: Update tables in java.base to be HTML 5-friendly. Reviewed-by: mchung, darcy, martin
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
     2
 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.net.ssl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * This class is for various network permissions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * An SSLPermission contains a name (also referred to as a "target name") but
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * no actions list; you either have the named permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * or you don't.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * The target name is the name of the network permission (see below). The naming
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * convention follows the  hierarchical property naming convention.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Also, an asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * may appear at the end of the name, following a ".", or by itself, to
14667
6862285acf46 7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents: 5506
diff changeset
    40
 * signify a wildcard match. For example: "foo.*" and "*" signify a wildcard
6862285acf46 7167056: Clarify that BasicPermission names that contain non-wildcard asterisks are not invalid
mullan
parents: 5506
diff changeset
    41
 * match, while "*foo" and "a*b" do not.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * The following table lists all the possible SSLPermission target names,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * and for each provides a description of what the permission allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * and a discussion of the risks of granting code the permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    47
 * <table class="striped">
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    48
 * <caption style="display:none">permission name, what it allows, and associated risks</caption>
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    49
 * <thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <th>Permission Target Name</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <th>What the Permission Allows</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <th>Risks of Allowing this Permission</th>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * </tr>
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    55
 * </thead>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    57
 * <tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *   <td>setHostnameVerifier</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *   <td>The ability to set a callback which can decide whether to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * allow a mismatch between the host being connected to by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * an HttpsURLConnection and the common name field in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * server certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 *  </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *   <td>Malicious
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * code can set a verifier that monitors host names visited by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * HttpsURLConnection requests or that allows server certificates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * with invalid common names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 *   <td>getSSLSessionContext</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 *   <td>The ability to get the SSLSessionContext of an SSLSession.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *   <td>Malicious code may monitor sessions which have been established
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * with SSL peers or might invalidate sessions to slow down performance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * <tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *   <td>setDefaultSSLContext</td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *   <td>The ability to set the default SSL context
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *   <td>Malicious code can set a context that monitors the opening of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * connections or the plaintext data that is transmitted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * </td>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * </tr>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *
45124
144479e89cdb 8179592: Update tables in java.base to be HTML 5-friendly.
jjg
parents: 25859
diff changeset
    90
 * </tbody>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * </table>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * @see java.security.BasicPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * @see java.security.Permission
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * @see java.security.Permissions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * @see java.security.PermissionCollection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * @see java.lang.SecurityManager
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * @author Marianne Mueller
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * @author Roland Schemers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
public final class SSLPermission extends BasicPermission {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    private static final long serialVersionUID = -3456898025505876775L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * Creates a new SSLPermission with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * The name is the symbolic name of the SSLPermission, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * "setDefaultAuthenticator", etc. An asterisk
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * may appear at the end of the name, following a ".", or by itself, to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * signify a wildcard match.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @param name the name of the SSLPermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @throws NullPointerException if <code>name</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public SSLPermission(String name)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
        super(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * Creates a new SSLPermission object with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     * The name is the symbolic name of the SSLPermission, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * actions String is currently unused and should be null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @param name the name of the SSLPermission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param actions ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @throws NullPointerException if <code>name</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @throws IllegalArgumentException if <code>name</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    public SSLPermission(String name, String actions)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        super(name, actions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
}