|
1 /* |
|
2 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
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 |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package jdk.net; |
|
27 |
|
28 import java.security.BasicPermission; |
|
29 |
|
30 /** |
|
31 * Represents permission to access the extended networking capabilities |
|
32 * defined in the jdk.net package. These permissions contain a target |
|
33 * name, but no actions list. Callers either possess the permission or not. |
|
34 * <p> |
|
35 * The following targets are defined: |
|
36 * |
|
37 * <table class="striped"><caption style="display:none">permission target name, |
|
38 * what the target allows,and associated risks</caption> |
|
39 * <thead> |
|
40 * <tr> |
|
41 * <th scope="col">Permission Target Name</th> |
|
42 * <th scope="col">What the Permission Allows</th> |
|
43 * <th scope="col">Risks of Allowing this Permission</th> |
|
44 * </tr> |
|
45 * </thead> |
|
46 * <tbody> |
|
47 * <tr> |
|
48 * <th scope="row">setOption.SO_FLOW_SLA</th> |
|
49 * <td>set the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} option |
|
50 * on any socket that supports it</td> |
|
51 * <td>allows caller to set a higher priority or bandwidth allocation |
|
52 * to sockets it creates, than they might otherwise be allowed.</td> |
|
53 * </tr> |
|
54 * <tr> |
|
55 * <th scope="row">getOption.SO_FLOW_SLA</th> |
|
56 * <td>retrieve the {@link ExtendedSocketOptions#SO_FLOW_SLA SO_FLOW_SLA} |
|
57 * setting from any socket that supports the option</td> |
|
58 * <td>allows caller access to SLA information that it might not |
|
59 * otherwise have</td> |
|
60 * </tr> |
|
61 * </tbody> |
|
62 * </table> |
|
63 * |
|
64 * @see jdk.net.ExtendedSocketOptions |
|
65 * |
|
66 * @since 1.8 |
|
67 */ |
|
68 |
|
69 public final class NetworkPermission extends BasicPermission { |
|
70 |
|
71 private static final long serialVersionUID = -2012939586906722291L; |
|
72 |
|
73 /** |
|
74 * Creates a NetworkPermission with the given target name. |
|
75 * |
|
76 * @param name the permission target name |
|
77 * @throws NullPointerException if {@code name} is {@code null}. |
|
78 * @throws IllegalArgumentException if {@code name} is empty. |
|
79 */ |
|
80 public NetworkPermission(String name) |
|
81 { |
|
82 super(name); |
|
83 } |
|
84 |
|
85 /** |
|
86 * Creates a NetworkPermission with the given target name. |
|
87 * |
|
88 * @param name the permission target name |
|
89 * @param actions should be {@code null}. Is ignored if not. |
|
90 * @throws NullPointerException if {@code name} is {@code null}. |
|
91 * @throws IllegalArgumentException if {@code name} is empty. |
|
92 */ |
|
93 public NetworkPermission(String name, String actions) |
|
94 { |
|
95 super(name, actions); |
|
96 } |
|
97 } |