Mercurial > hg > digilib-old
comparison common/src/main/java/digilib/auth/AuthOps.java @ 903:7779b37d1d05
refactored into maven modules per servlet type.
can build servlet-api 2.3 and 3.0 via profile now!
author | robcast |
---|---|
date | Tue, 26 Apr 2011 20:24:31 +0200 |
parents | servlet/src/main/java/digilib/auth/AuthOps.java@ba1eb2d821a2 |
children |
comparison
equal
deleted
inserted
replaced
902:89ba3ffcf552 | 903:7779b37d1d05 |
---|---|
1 /* AuthOps -- Authentication interface class | |
2 | |
3 Digital Image Library servlet components | |
4 | |
5 Copyright (C) 2001, 2002 Robert Casties (robcast@mail.berlios.de) | |
6 | |
7 This program is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
9 Free Software Foundation; either version 2 of the License, or (at your | |
10 option) any later version. | |
11 | |
12 Please read license.txt for the full details. A copy of the GPL | |
13 may be found at http://www.gnu.org/copyleft/lgpl.html | |
14 | |
15 You should have received a copy of the GNU General Public License | |
16 along with this program; if not, write to the Free Software | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 */ | |
20 | |
21 package digilib.auth; | |
22 | |
23 import java.util.List; | |
24 | |
25 import javax.servlet.http.HttpServletRequest; | |
26 | |
27 import digilib.servlet.DigilibRequest; | |
28 | |
29 /** Class of operations requiring authentication. */ | |
30 public interface AuthOps { | |
31 | |
32 /** Test if the request must be authorized to access the filepath. | |
33 * | |
34 * Information about the user is taken from the ServletRequest. | |
35 * @param filepath filepath to be accessed. | |
36 * @param request ServletRequest with user information. | |
37 * @throws AuthOpException Exception thrown on error. | |
38 * @return true if the user request must be authorized. | |
39 */ | |
40 public boolean isAuthRequired(String filepath, HttpServletRequest request) | |
41 throws AuthOpException; | |
42 | |
43 /** Test if the request must be authorized to access the filepath. | |
44 * | |
45 * Information about the user is taken from the DigilibRequest. | |
46 * @param request DigilibRequest with user information. | |
47 * @throws AuthOpException Exception thrown on error. | |
48 * @return true if the user request must be authorized. | |
49 */ | |
50 public boolean isAuthRequired(DigilibRequest request) | |
51 throws AuthOpException; | |
52 | |
53 /** Test if the request is allowed to access filepath. | |
54 * | |
55 * @param filepath filepath to be acessed. | |
56 * @param request Request with user information. | |
57 * @throws AuthOpException Exception thrown on error. | |
58 * @return true if the request is allowed. | |
59 */ | |
60 public boolean isAuthorized(String filepath, HttpServletRequest request) | |
61 throws AuthOpException; | |
62 | |
63 /** Test if the request is allowed to access filepath. | |
64 * | |
65 * @param request Request with user information. | |
66 * @throws AuthOpException Exception thrown on error. | |
67 * @return true if the request is allowed. | |
68 */ | |
69 public boolean isAuthorized(DigilibRequest request) | |
70 throws AuthOpException; | |
71 | |
72 /** Authorization roles needed for request. | |
73 * | |
74 * Returns the list of authorization roles that are needed to access the | |
75 * specified path. No list means the path is free. | |
76 * | |
77 * The location information of the request is also considered. | |
78 * | |
79 * @param filepath filepath to be accessed. | |
80 * @param request ServletRequest with address information. | |
81 * @throws AuthOpException Exception thrown on error. | |
82 * @return List of Strings with role names. | |
83 */ | |
84 public List<String> rolesForPath(String filepath, HttpServletRequest request) | |
85 throws AuthOpException; | |
86 | |
87 /** Authorization roles needed for request. | |
88 * | |
89 * Returns the list of authorization roles that are needed to access the | |
90 * specified path. No list means the path is free. | |
91 * | |
92 * The location information of the request is also considered. | |
93 * | |
94 * @param request DigilibRequest with address information. | |
95 * @throws AuthOpException Exception thrown on error. | |
96 * @return List of Strings with role names. | |
97 */ | |
98 public List<String> rolesForPath(DigilibRequest request) | |
99 throws AuthOpException; | |
100 | |
101 /** Test request authorization against a list of roles. | |
102 * @param roles List of Strings with role names. | |
103 * @param request ServletRequest with address information. | |
104 * @return true if the user information in the request authorizes one of the roles. | |
105 */ | |
106 public boolean isRoleAuthorized(List<String> roles, HttpServletRequest request); | |
107 | |
108 /** Test request authorization against a list of roles. | |
109 * @param roles List of Strings with role names. | |
110 * @param request ServletRequest with address information. | |
111 * @return true if the user information in the request authorizes one of the roles. | |
112 */ | |
113 public boolean isRoleAuthorized(List<String> roles, DigilibRequest request); | |
114 | |
115 } |