annotate servlet/src/digilib/auth/AuthOps.java @ 158:e9a81ac446cb

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