66
66
*/
67
67
public interface AccessController {
68
68
69
- /**
70
- * <code>isAuthorized</code> executes the <code>AccessControlRule</code>
71
- * that is identified by <code>key</code> and listed in the
72
- * <code>resources/ESAPI-AccessControlPolicy.xml</code> file. It returns
73
- * true if the <code>AccessControlRule</code> decides that the operation
74
- * should be allowed. Otherwise, it returns false. Any exception thrown by
75
- * the <code>AccessControlRule</code> must result in false. If
76
- * <code>key</code> does not map to an <code>AccessControlRule</code>, then
77
- * false is returned.
78
- *
79
- * Developers should call isAuthorized to control execution flow. For
80
- * example, if you want to decide whether to display a UI widget in the
81
- * browser using the same logic that you will use to enforce permissions
82
- * on the server, then isAuthorized is the method that you want to use.
83
- *
84
- * Typically, assertAuthorized should be used to enforce permissions on the
85
- * server.
86
- *
87
- * @param key <code>key</code> maps to
88
- * <code><AccessControlPolicy><AccessControlRules>
89
- * <AccessControlRule name="key"</code>
90
- * @param runtimeParameter runtimeParameter can contain anything that
91
- * the AccessControlRule needs from the runtime system.
92
- * @return Returns <code>true</code> if and only if the AccessControlRule specified
93
- * by <code>key</code> exists and returned <code>true</code>.
94
- * Otherwise returns <code>false</code>
95
- */
96
- boolean isAuthorized (Object key , Object runtimeParameter );
97
-
98
- /**
99
- * <code>assertAuthorized</code> executes the <code>AccessControlRule</code>
100
- * that is identified by <code>key</code> and listed in the
101
- * <code>resources/ESAPI-AccessControlPolicy.xml</code> file. It does
102
- * nothing if the <code>AccessControlRule</code> decides that the operation
103
- * should be allowed. Otherwise, it throws an
104
- * <code>org.owasp.esapi.errors.AccessControlException</code>. Any exception
105
- * thrown by the <code>AccessControlRule</code> will also result in an
106
- * <code>AccesControlException</code>. If <code>key</code> does not map to
107
- * an <code>AccessControlRule</code>, then an <code>AccessControlException
108
- * </code> is thrown.
109
- *
110
- * Developers should call {@code assertAuthorized} to enforce privileged access to
111
- * the system. It should be used to answer the question: "Should execution
112
- * continue." Ideally, the call to <code>assertAuthorized</code> should
113
- * be integrated into the application framework so that it is called
114
- * automatically.
115
- *
116
- * @param key <code>key</code> maps to
117
- * <AccessControlPolicy><AccessControlRules>
118
- * <AccessControlRule name="key"
119
- * @param runtimeParameter runtimeParameter can contain anything that
120
- * the AccessControlRule needs from the runtime system.
121
- */
122
- void assertAuthorized (Object key , Object runtimeParameter )
123
- throws AccessControlException ;
69
+ /**
70
+ * <code>isAuthorized</code> executes the <code>AccessControlRule</code>
71
+ * that is identified by <code>key</code> and listed in the
72
+ * <code>resources/ESAPI-AccessControlPolicy.xml</code> file. It returns
73
+ * true if the <code>AccessControlRule</code> decides that the operation
74
+ * should be allowed. Otherwise, it returns false. Any exception thrown by
75
+ * the <code>AccessControlRule</code> must result in false. If
76
+ * <code>key</code> does not map to an <code>AccessControlRule</code>, then
77
+ * false is returned.
78
+ *
79
+ * Developers should call isAuthorized to control execution flow. For
80
+ * example, if you want to decide whether to display a UI widget in the
81
+ * browser using the same logic that you will use to enforce permissions
82
+ * on the server, then isAuthorized is the method that you want to use.
83
+ *
84
+ * Typically, assertAuthorized should be used to enforce permissions on the
85
+ * server.
86
+ *
87
+ * @param key <code>key</code> maps to
88
+ * <code><AccessControlPolicy><AccessControlRules>
89
+ * <AccessControlRule name="key"</code>
90
+ * @param runtimeParameter runtimeParameter can contain anything that
91
+ * the AccessControlRule needs from the runtime system.
92
+ * @return Returns <code>true</code> if and only if the AccessControlRule specified
93
+ * by <code>key</code> exists and returned <code>true</code>.
94
+ * Otherwise returns <code>false</code>
95
+ */
96
+ boolean isAuthorized (Object key , Object runtimeParameter );
97
+
98
+ /**
99
+ * <code>assertAuthorized</code> executes the <code>AccessControlRule</code>
100
+ * that is identified by <code>key</code> and listed in the
101
+ * <code>resources/ESAPI-AccessControlPolicy.xml</code> file. It does
102
+ * nothing if the <code>AccessControlRule</code> decides that the operation
103
+ * should be allowed. Otherwise, it throws an
104
+ * <code>org.owasp.esapi.errors.AccessControlException</code>. Any exception
105
+ * thrown by the <code>AccessControlRule</code> will also result in an
106
+ * <code>AccesControlException</code>. If <code>key</code> does not map to
107
+ * an <code>AccessControlRule</code>, then an <code>AccessControlException
108
+ * </code> is thrown.
109
+ *
110
+ * Developers should call {@code assertAuthorized} to enforce privileged access to
111
+ * the system. It should be used to answer the question: "Should execution
112
+ * continue." Ideally, the call to <code>assertAuthorized</code> should
113
+ * be integrated into the application framework so that it is called
114
+ * automatically.
115
+ *
116
+ * @param key <code>key</code> maps to
117
+ * <AccessControlPolicy><AccessControlRules>
118
+ * <AccessControlRule name="key"
119
+ * @param runtimeParameter runtimeParameter can contain anything that
120
+ * the AccessControlRule needs from the runtime system.
121
+ */
122
+ void assertAuthorized (Object key , Object runtimeParameter )
123
+ throws AccessControlException ;
124
124
125
-
125
+
126
126
127
-
128
- /*** Below this line has been deprecated as of ESAPI 1.6 ***/
129
-
130
-
131
-
132
-
127
+
128
+ /*** Below this line has been deprecated as of ESAPI 1.6 ***/
129
+
130
+
131
+
132
+
133
133
/**
134
134
* Checks if the current user is authorized to access the referenced URL. Generally, this method should be invoked in the
135
135
* application's controller or a filter as follows:
@@ -140,10 +140,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
140
140
* exception would be logged.
141
141
*
142
142
* @param url
143
- * the URL as returned by request.getRequestURI().toString()
143
+ * the URL as returned by request.getRequestURI().toString()
144
144
*
145
145
* @return
146
- * true, if is authorized for URL
146
+ * true, if is authorized for URL
147
147
*/
148
148
@ Deprecated
149
149
boolean isAuthorizedForURL (String url );
@@ -155,10 +155,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
155
155
* AccessControlException is not thrown, this method should return true.
156
156
*
157
157
* @param functionName
158
- * the name of the function
158
+ * the name of the function
159
159
*
160
160
* @return
161
- * true, if is authorized for function
161
+ * true, if is authorized for function
162
162
*/
163
163
@ Deprecated
164
164
boolean isAuthorizedForFunction (String functionName );
@@ -175,10 +175,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
175
175
* (e.g., Read, Write, etc.), or the name of the function the data is being passed to.
176
176
*
177
177
* @param data
178
- * The actual object or object identifier being accessed or a reference to the object being accessed.
178
+ * The actual object or object identifier being accessed or a reference to the object being accessed.
179
179
*
180
180
* @return
181
- * true, if is authorized for the data
181
+ * true, if is authorized for the data
182
182
*/
183
183
@ Deprecated
184
184
boolean isAuthorizedForData (String action , Object data );
@@ -190,10 +190,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
190
190
* is not thrown, this method should return true.
191
191
*
192
192
* @param filepath
193
- * the path of the file to be checked, including filename
193
+ * the path of the file to be checked, including filename
194
194
*
195
195
* @return
196
- * true, if is authorized for the file
196
+ * true, if is authorized for the file
197
197
*/
198
198
@ Deprecated
199
199
boolean isAuthorizedForFile (String filepath );
@@ -206,10 +206,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
206
206
* AccessControlException is not thrown, this method should return true.
207
207
*
208
208
* @param serviceName
209
- * the service name
209
+ * the service name
210
210
*
211
211
* @return
212
- * true, if is authorized for the service
212
+ * true, if is authorized for the service
213
213
*/
214
214
@ Deprecated
215
215
boolean isAuthorizedForService (String serviceName );
@@ -229,16 +229,16 @@ void assertAuthorized(Object key, Object runtimeParameter)
229
229
* <li>Use available information to make an access control decision</li>
230
230
* <ol type="a">
231
231
* <li>Ideally, this policy would be data driven</li>
232
- * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
233
- * <li>Access control decisions must deny by default</li>
232
+ * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
233
+ * <li>Access control decisions must deny by default</li>
234
234
* </ol>
235
235
* <li>If access is not permitted, throw an AccessControlException with details</li>
236
236
* </ol>
237
237
* @param url
238
- * the URL as returned by request.getRequestURI().toString()
238
+ * the URL as returned by request.getRequestURI().toString()
239
239
*
240
240
* @throws AccessControlException
241
- * if access is not permitted
241
+ * if access is not permitted
242
242
*/
243
243
@ Deprecated
244
244
void assertAuthorizedForURL (String url ) throws AccessControlException ;
@@ -257,17 +257,17 @@ void assertAuthorized(Object key, Object runtimeParameter)
257
257
* <li>Use available information to make an access control decision</li>
258
258
* <ol type="a">
259
259
* <li>Ideally, this policy would be data driven</li>
260
- * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
261
- * <li>Access control decisions must deny by default</li>
260
+ * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
261
+ * <li>Access control decisions must deny by default</li>
262
262
* </ol>
263
263
* <li>If access is not permitted, throw an AccessControlException with details</li>
264
264
* </ol>
265
265
*
266
266
* @param functionName
267
- * the function name
267
+ * the function name
268
268
*
269
269
* @throws AccessControlException
270
- * if access is not permitted
270
+ * if access is not permitted
271
271
*/
272
272
@ Deprecated
273
273
void assertAuthorizedForFunction (String functionName ) throws AccessControlException ;
@@ -283,8 +283,8 @@ void assertAuthorized(Object key, Object runtimeParameter)
283
283
* <li>Use available information to make an access control decision</li>
284
284
* <ol type="a">
285
285
* <li>Ideally, this policy would be data driven</li>
286
- * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
287
- * <li>Access control decisions must deny by default</li>
286
+ * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
287
+ * <li>Access control decisions must deny by default</li>
288
288
* </ol>
289
289
* <li>If access is not permitted, throw an AccessControlException with details</li>
290
290
* </ol>
@@ -294,10 +294,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
294
294
* (e.g., Read, Write, etc.), or the name of the function the data is being passed to.
295
295
*
296
296
* @param data
297
- * The actual object or object identifier being accessed or a reference to the object being accessed.
297
+ * The actual object or object identifier being accessed or a reference to the object being accessed.
298
298
*
299
299
* @throws AccessControlException
300
- * if access is not permitted
300
+ * if access is not permitted
301
301
*/
302
302
@ Deprecated
303
303
void assertAuthorizedForData (String action , Object data ) throws AccessControlException ;
@@ -315,14 +315,14 @@ void assertAuthorized(Object key, Object runtimeParameter)
315
315
* <li>Use available information to make an access control decision</li>
316
316
* <ol type="a">
317
317
* <li>Ideally, this policy would be data driven</li>
318
- * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
319
- * <li>Access control decisions must deny by default</li>
318
+ * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
319
+ * <li>Access control decisions must deny by default</li>
320
320
* </ol>
321
321
* <li>If access is not permitted, throw an AccessControlException with details</li>
322
322
* </ol>
323
323
*
324
324
* @param filepath
325
- * Path to the file to be checked
325
+ * Path to the file to be checked
326
326
* @throws AccessControlException if access is denied
327
327
*/
328
328
@ Deprecated
@@ -341,18 +341,18 @@ void assertAuthorized(Object key, Object runtimeParameter)
341
341
* <li>Use available information to make an access control decision</li>
342
342
* <ol type="a">
343
343
* <li>Ideally, this policy would be data driven</li>
344
- * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
345
- * <li>Access control decisions must deny by default</li>
344
+ * <li>You can use the current User, roles, data type, data name, time of day, etc.</li>
345
+ * <li>Access control decisions must deny by default</li>
346
346
* </ol>
347
347
* <li>If access is not permitted, throw an AccessControlException with details</li>
348
348
* </ol>
349
349
*
350
350
* @param serviceName
351
- * the service name
351
+ * the service name
352
352
*
353
353
* @throws AccessControlException
354
- * if access is not permitted
355
- */
354
+ * if access is not permitted
355
+ */
356
356
@ Deprecated
357
357
void assertAuthorizedForService (String serviceName ) throws AccessControlException ;
358
358
0 commit comments