Asankhaya Sharma
commited on
Commit
·
55ca6ec
1
Parent(s):
4eb731d
data/train/Java/AbstractConstantRestrictor.java
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
package org.jolokia.restrictor;
|
2 |
-
|
3 |
-
/*
|
4 |
-
* Copyright 2009-2011 Roland Huss
|
5 |
-
*
|
6 |
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
7 |
-
* you may not use this file except in compliance with the License.
|
8 |
-
* You may obtain a copy of the License at
|
9 |
-
*
|
10 |
-
* http://www.apache.org/licenses/LICENSE-2.0
|
11 |
-
*
|
12 |
-
* Unless required by applicable law or agreed to in writing, software
|
13 |
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
14 |
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 |
-
* See the License for the specific language governing permissions and
|
16 |
-
* limitations under the License.
|
17 |
-
*/
|
18 |
-
|
19 |
-
import javax.management.ObjectName;
|
20 |
-
|
21 |
-
import org.jolokia.util.HttpMethod;
|
22 |
-
import org.jolokia.util.RequestType;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Base restrictor which alway returns the constant given
|
26 |
-
* at construction time
|
27 |
-
*
|
28 |
-
* @author roland
|
29 |
-
* @since 06.10.11
|
30 |
-
*/
|
31 |
-
public abstract class AbstractConstantRestrictor implements Restrictor {
|
32 |
-
|
33 |
-
private boolean isAllowed;
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Create restrictor which always returns the given value on every check
|
37 |
-
* method.
|
38 |
-
*
|
39 |
-
* @param pAllowed whether access is allowed or denied
|
40 |
-
*/
|
41 |
-
protected AbstractConstantRestrictor(boolean pAllowed) {
|
42 |
-
isAllowed = pAllowed;
|
43 |
-
}
|
44 |
-
|
45 |
-
/** {@inheritDoc} */
|
46 |
-
public final boolean isHttpMethodAllowed(HttpMethod pMethod) {
|
47 |
-
return isAllowed;
|
48 |
-
}
|
49 |
-
|
50 |
-
/** {@inheritDoc} */
|
51 |
-
public final boolean isTypeAllowed(RequestType pType) {
|
52 |
-
return isAllowed;
|
53 |
-
}
|
54 |
-
|
55 |
-
/** {@inheritDoc} */
|
56 |
-
public final boolean isAttributeReadAllowed(ObjectName pName, String pAttribute) {
|
57 |
-
return isAllowed;
|
58 |
-
}
|
59 |
-
|
60 |
-
/** {@inheritDoc} */
|
61 |
-
public final boolean isAttributeWriteAllowed(ObjectName pName, String pAttribute) {
|
62 |
-
return isAllowed;
|
63 |
-
}
|
64 |
-
|
65 |
-
/** {@inheritDoc} */
|
66 |
-
public final boolean isOperationAllowed(ObjectName pName, String pOperation) {
|
67 |
-
return isAllowed;
|
68 |
-
}
|
69 |
-
|
70 |
-
/** {@inheritDoc} */
|
71 |
-
public final boolean isRemoteAccessAllowed(String... pHostOrAddress) {
|
72 |
-
return isAllowed;
|
73 |
-
}
|
74 |
-
|
75 |
-
/** {@inheritDoc} */
|
76 |
-
// BUG: CWE-352 Cross-Site Request Forgery (CSRF)
|
77 |
-
// public boolean isCorsAccessAllowed(String pOrigin) {
|
78 |
-
// FIXED:
|
79 |
-
public boolean isOriginAllowed(String pOrigin, boolean pIsStrictCheck) {
|
80 |
-
return isAllowed;
|
81 |
-
}
|
82 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/train/{AbstractConstantRestrictor.txt → Java/AbstractConstantRestrictor.txt}
RENAMED
File without changes
|