6666 */
6767public interface AccessController {
6868
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 ;
124124
125-
125+
126126
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+
133133 /**
134134 * Checks if the current user is authorized to access the referenced URL. Generally, this method should be invoked in the
135135 * application's controller or a filter as follows:
@@ -140,10 +140,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
140140 * exception would be logged.
141141 *
142142 * @param url
143- * the URL as returned by request.getRequestURI().toString()
143+ * the URL as returned by request.getRequestURI().toString()
144144 *
145145 * @return
146- * true, if is authorized for URL
146+ * true, if is authorized for URL
147147 */
148148 @ Deprecated
149149 boolean isAuthorizedForURL (String url );
@@ -155,10 +155,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
155155 * AccessControlException is not thrown, this method should return true.
156156 *
157157 * @param functionName
158- * the name of the function
158+ * the name of the function
159159 *
160160 * @return
161- * true, if is authorized for function
161+ * true, if is authorized for function
162162 */
163163 @ Deprecated
164164 boolean isAuthorizedForFunction (String functionName );
@@ -175,10 +175,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
175175 * (e.g., Read, Write, etc.), or the name of the function the data is being passed to.
176176 *
177177 * @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.
179179 *
180180 * @return
181- * true, if is authorized for the data
181+ * true, if is authorized for the data
182182 */
183183 @ Deprecated
184184 boolean isAuthorizedForData (String action , Object data );
@@ -190,10 +190,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
190190 * is not thrown, this method should return true.
191191 *
192192 * @param filepath
193- * the path of the file to be checked, including filename
193+ * the path of the file to be checked, including filename
194194 *
195195 * @return
196- * true, if is authorized for the file
196+ * true, if is authorized for the file
197197 */
198198 @ Deprecated
199199 boolean isAuthorizedForFile (String filepath );
@@ -206,10 +206,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
206206 * AccessControlException is not thrown, this method should return true.
207207 *
208208 * @param serviceName
209- * the service name
209+ * the service name
210210 *
211211 * @return
212- * true, if is authorized for the service
212+ * true, if is authorized for the service
213213 */
214214 @ Deprecated
215215 boolean isAuthorizedForService (String serviceName );
@@ -229,16 +229,16 @@ void assertAuthorized(Object key, Object runtimeParameter)
229229 * <li>Use available information to make an access control decision</li>
230230 * <ol type="a">
231231 * <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>
234234 * </ol>
235235 * <li>If access is not permitted, throw an AccessControlException with details</li>
236236 * </ol>
237237 * @param url
238- * the URL as returned by request.getRequestURI().toString()
238+ * the URL as returned by request.getRequestURI().toString()
239239 *
240240 * @throws AccessControlException
241- * if access is not permitted
241+ * if access is not permitted
242242 */
243243 @ Deprecated
244244 void assertAuthorizedForURL (String url ) throws AccessControlException ;
@@ -257,17 +257,17 @@ void assertAuthorized(Object key, Object runtimeParameter)
257257 * <li>Use available information to make an access control decision</li>
258258 * <ol type="a">
259259 * <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>
262262 * </ol>
263263 * <li>If access is not permitted, throw an AccessControlException with details</li>
264264 * </ol>
265265 *
266266 * @param functionName
267- * the function name
267+ * the function name
268268 *
269269 * @throws AccessControlException
270- * if access is not permitted
270+ * if access is not permitted
271271 */
272272 @ Deprecated
273273 void assertAuthorizedForFunction (String functionName ) throws AccessControlException ;
@@ -283,8 +283,8 @@ void assertAuthorized(Object key, Object runtimeParameter)
283283 * <li>Use available information to make an access control decision</li>
284284 * <ol type="a">
285285 * <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>
288288 * </ol>
289289 * <li>If access is not permitted, throw an AccessControlException with details</li>
290290 * </ol>
@@ -294,10 +294,10 @@ void assertAuthorized(Object key, Object runtimeParameter)
294294 * (e.g., Read, Write, etc.), or the name of the function the data is being passed to.
295295 *
296296 * @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.
298298 *
299299 * @throws AccessControlException
300- * if access is not permitted
300+ * if access is not permitted
301301 */
302302 @ Deprecated
303303 void assertAuthorizedForData (String action , Object data ) throws AccessControlException ;
@@ -315,14 +315,14 @@ void assertAuthorized(Object key, Object runtimeParameter)
315315 * <li>Use available information to make an access control decision</li>
316316 * <ol type="a">
317317 * <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>
320320 * </ol>
321321 * <li>If access is not permitted, throw an AccessControlException with details</li>
322322 * </ol>
323323 *
324324 * @param filepath
325- * Path to the file to be checked
325+ * Path to the file to be checked
326326 * @throws AccessControlException if access is denied
327327 */
328328 @ Deprecated
@@ -341,18 +341,18 @@ void assertAuthorized(Object key, Object runtimeParameter)
341341 * <li>Use available information to make an access control decision</li>
342342 * <ol type="a">
343343 * <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>
346346 * </ol>
347347 * <li>If access is not permitted, throw an AccessControlException with details</li>
348348 * </ol>
349349 *
350350 * @param serviceName
351- * the service name
351+ * the service name
352352 *
353353 * @throws AccessControlException
354- * if access is not permitted
355- */
354+ * if access is not permitted
355+ */
356356 @ Deprecated
357357 void assertAuthorizedForService (String serviceName ) throws AccessControlException ;
358358
0 commit comments