# HG changeset patch # User robcast # Date 1043440859 -3600 # Node ID 300d5ba8b33b39633afdd059cadb9281de88ed86 # Parent d493563ef67211bd96acc992b5f383495e2bf121 New servlet version 1.5b. Mostly cleanup. Global parameters for digilib now in DigilibConfiguration, per request parameters are now all in DigilibRequest. The DocuImage implementation can be selected by the configuration docuimage-class. Pixel-by-pixel view implemented with "mo=clip". diff -r d493563ef672 -r 300d5ba8b33b servlet/src/digilib/auth/AuthOps.java --- a/servlet/src/digilib/auth/AuthOps.java Fri Jan 24 21:40:59 2003 +0100 +++ b/servlet/src/digilib/auth/AuthOps.java Fri Jan 24 21:40:59 2003 +0100 @@ -20,33 +20,96 @@ package digilib.auth; +import java.util.List; -import java.io.*; -import java.util.*; -import javax.servlet.http.*; +import javax.servlet.http.HttpServletRequest; +import digilib.servlet.DigilibRequest; + +/** Class of operations requiring authentication. */ public interface AuthOps { - /** - * check if the request must be authorized to access filepath - */ - public boolean isAuthRequired(String filepath, HttpServletRequest request) throws AuthOpException; + /** Test if the request must be authorized to access the filepath. + * + * Information about the user is taken from the ServletRequest. + * @param filepath filepath to be accessed. + * @param request ServletRequest with user information. + * @throws AuthOpException Exception thrown on error. + * @return true if the user request must be authorized. + */ + public boolean isAuthRequired(String filepath, HttpServletRequest request) + throws AuthOpException; - /** - * check if the request is allowed to access filepath - */ - public boolean isAuthorized(String filepath, HttpServletRequest request) throws AuthOpException; + /** Test if the request must be authorized to access the filepath. + * + * Information about the user is taken from the DigilibRequest. + * @param request DigilibRequest with user information. + * @throws AuthOpException Exception thrown on error. + * @return true if the user request must be authorized. + */ + public boolean isAuthRequired(DigilibRequest request) + throws AuthOpException; + + /** Test if the request is allowed to access filepath. + * + * @param filepath filepath to be acessed. + * @param request Request with user information. + * @throws AuthOpException Exception thrown on error. + * @return true if the request is allowed. + */ + public boolean isAuthorized(String filepath, HttpServletRequest request) + throws AuthOpException; + + /** Test if the request is allowed to access filepath. + * + * @param request Request with user information. + * @throws AuthOpException Exception thrown on error. + * @return true if the request is allowed. + */ + public boolean isAuthorized(DigilibRequest request) + throws AuthOpException; - /** - * return a list of authorization roles needed for request - * to access the specified path - * (does not look at request address for now) - */ - public List rolesForPath(String filepath, HttpServletRequest request) throws AuthOpException; + /** Authorization roles needed for request. + * + * Returns the list of authorization roles that are needed to access the + * specified path. No list means the path is free. + * + * The location information of the request is also considered. + * + * @param filepath filepath to be accessed. + * @param request ServletRequest with address information. + * @throws AuthOpException Exception thrown on error. + * @return List of Strings with role names. + */ + public List rolesForPath(String filepath, HttpServletRequest request) + throws AuthOpException; - /** - * check request authorization against a list of roles - */ - public boolean isRoleAuthorized(List roles, HttpServletRequest request); + /** Authorization roles needed for request. + * + * Returns the list of authorization roles that are needed to access the + * specified path. No list means the path is free. + * + * The location information of the request is also considered. + * + * @param request DigilibRequest with address information. + * @throws AuthOpException Exception thrown on error. + * @return List of Strings with role names. + */ + public List rolesForPath(DigilibRequest request) + throws AuthOpException; + + /** Test request authorization against a list of roles. + * @param roles List of Strings with role names. + * @param request ServletRequest with address information. + * @return true if the user information in the request authorizes one of the roles. + */ + public boolean isRoleAuthorized(List roles, HttpServletRequest request); + + /** Test request authorization against a list of roles. + * @param roles List of Strings with role names. + * @param request ServletRequest with address information. + * @return true if the user information in the request authorizes one of the roles. + */ + public boolean isRoleAuthorized(List roles, DigilibRequest request); }