Package digilib.auth
Class IpServletAuthnOps
- java.lang.Object
-
- digilib.auth.IpAuthnOps
-
- digilib.auth.IpServletAuthnOps
-
- All Implemented Interfaces:
AuthnOps
public class IpServletAuthnOps extends IpAuthnOps
Implements AuthnOps using IP adresses defined in an XML config file and Servlet API isUserInRole(). The name of the configuration file is read from the digilib config parameter "auth-file". The tag "digilib-adresses" is read from the configuration file:<digilib-addresses> <address ip="130.92.68" role="eastwood-coll,ptolemaios-geo" /> <address ip="130.92.151" role="wtwg" /> <address ip="0:0:0:0:0:0:0:1" role="local" /> </digilib-addresses>
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
logger
-
Fields inherited from class digilib.auth.IpAuthnOps
authIP4s, authIP6s, configFile
-
-
Constructor Summary
Constructors Constructor Description IpServletAuthnOps()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<String>
getUserRoles(DigilibRequest dlRequest)
Return the list of roles associated with the user represented by request.boolean
hasUserRoles()
Return if the implementation supports getUserRoles().boolean
isUserInRole(DigilibRequest dlRequest, String role)
Test if the user represented by request has the given role.-
Methods inherited from class digilib.auth.IpAuthnOps
init
-
-
-
-
Method Detail
-
hasUserRoles
public boolean hasUserRoles()
Description copied from interface:AuthnOps
Return if the implementation supports getUserRoles().- Specified by:
hasUserRoles
in interfaceAuthnOps
- Overrides:
hasUserRoles
in classIpAuthnOps
- Returns:
- true if the implementation supports getUserRoles().
-
getUserRoles
public List<String> getUserRoles(DigilibRequest dlRequest) throws AuthOpException
Description copied from interface:AuthnOps
Return the list of roles associated with the user represented by request. Returns null if a list of roles is not available. Users of this API should check hasUserRoles().- Specified by:
getUserRoles
in interfaceAuthnOps
- Overrides:
getUserRoles
in classIpAuthnOps
- Parameters:
dlRequest
- current DigilibRequest- Returns:
- list of user's roles
- Throws:
AuthOpException
- Exception thrown on error.
-
isUserInRole
public boolean isUserInRole(DigilibRequest dlRequest, String role) throws AuthOpException
Description copied from interface:AuthnOps
Test if the user represented by request has the given role.- Specified by:
isUserInRole
in interfaceAuthnOps
- Overrides:
isUserInRole
in classIpAuthnOps
- Parameters:
dlRequest
- Request with user information.role
- role to be tested.- Returns:
- true if the user has the role.
- Throws:
AuthOpException
- Exception thrown on error.
-
-