Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/javax/net/ssl/SSLPermission.java
38918 views
/*1* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.net.ssl;2627import java.security.*;2829/**30* This class is for various network permissions.31* An SSLPermission contains a name (also referred to as a "target name") but32* no actions list; you either have the named permission33* or you don't.34* <P>35* The target name is the name of the network permission (see below). The naming36* convention follows the hierarchical property naming convention.37* Also, an asterisk38* may appear at the end of the name, following a ".", or by itself, to39* signify a wildcard match. For example: "foo.*" and "*" signify a wildcard40* match, while "*foo" and "a*b" do not.41* <P>42* The following table lists all the possible SSLPermission target names,43* and for each provides a description of what the permission allows44* and a discussion of the risks of granting code the permission.45*46* <table border=1 cellpadding=547* summary="permission name, what it allows, and associated risks">48* <tr>49* <th>Permission Target Name</th>50* <th>What the Permission Allows</th>51* <th>Risks of Allowing this Permission</th>52* </tr>53*54* <tr>55* <td>setHostnameVerifier</td>56* <td>The ability to set a callback which can decide whether to57* allow a mismatch between the host being connected to by58* an HttpsURLConnection and the common name field in59* server certificate.60* </td>61* <td>Malicious62* code can set a verifier that monitors host names visited by63* HttpsURLConnection requests or that allows server certificates64* with invalid common names.65* </td>66* </tr>67*68* <tr>69* <td>getSSLSessionContext</td>70* <td>The ability to get the SSLSessionContext of an SSLSession.71* </td>72* <td>Malicious code may monitor sessions which have been established73* with SSL peers or might invalidate sessions to slow down performance.74* </td>75* </tr>76*77* <tr>78* <td>setDefaultSSLContext</td>79* <td>The ability to set the default SSL context80* </td>81* <td>Malicious code can set a context that monitors the opening of82* connections or the plaintext data that is transmitted.83* </td>84* </tr>85*86* </table>87*88* @see java.security.BasicPermission89* @see java.security.Permission90* @see java.security.Permissions91* @see java.security.PermissionCollection92* @see java.lang.SecurityManager93*94* @since 1.495* @author Marianne Mueller96* @author Roland Schemers97*/9899public final class SSLPermission extends BasicPermission {100101private static final long serialVersionUID = -3456898025505876775L;102103/**104* Creates a new SSLPermission with the specified name.105* The name is the symbolic name of the SSLPermission, such as106* "setDefaultAuthenticator", etc. An asterisk107* may appear at the end of the name, following a ".", or by itself, to108* signify a wildcard match.109*110* @param name the name of the SSLPermission.111*112* @throws NullPointerException if <code>name</code> is null.113* @throws IllegalArgumentException if <code>name</code> is empty.114*/115116public SSLPermission(String name)117{118super(name);119}120121/**122* Creates a new SSLPermission object with the specified name.123* The name is the symbolic name of the SSLPermission, and the124* actions String is currently unused and should be null.125*126* @param name the name of the SSLPermission.127* @param actions ignored.128*129* @throws NullPointerException if <code>name</code> is null.130* @throws IllegalArgumentException if <code>name</code> is empty.131*/132133public SSLPermission(String name, String actions)134{135super(name, actions);136}137}138139140