Package digilib.auth
Class IpAuthnOps
java.lang.Object
digilib.auth.IpAuthnOps
- All Implemented Interfaces:
AuthnOps
- Direct Known Subclasses:
IpOpenIdAuthnOps,IpServletAuthnOps
Implements AuthnOps using IP adresses defined in an XML config file.
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>
A computer with an ip address that matches "ip" is automatically granted all roles under "role".
The ip address is matched from the left (in full quads). Roles under "role" must be separated by comma only (no spaces).-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetUserRoles(DigilibRequest dlRequest) Return the list of roles associated with the user represented by request.booleanReturn if the implementation supports getUserRoles().voidinit(DigilibConfiguration dlConfig) Initialize authentication operations.booleanisUserInRole(DigilibRequest dlRequest, String role) Test if the user represented by request has the given role.
-
Field Details
-
logger
protected static final org.slf4j.Logger loggergeneral logger for this class -
configFile
-
authIP4s
-
authIP6s
-
-
Constructor Details
-
IpAuthnOps
public IpAuthnOps()
-
-
Method Details
-
init
Initialize authentication operations. Reads tag "digilib-adresses" from configuration file and sets up authentication arrays.- Specified by:
initin interfaceAuthnOps- Parameters:
dlConfig- current DigilibConfiguration- Throws:
AuthOpException- Exception thrown on error.
-
hasUserRoles
public boolean hasUserRoles()Description copied from interface:AuthnOpsReturn if the implementation supports getUserRoles().- Specified by:
hasUserRolesin interfaceAuthnOps- Returns:
- true if the implementation supports getUserRoles().
-
getUserRoles
Description copied from interface:AuthnOpsReturn 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:
getUserRolesin interfaceAuthnOps- Parameters:
dlRequest- current DigilibRequest- Returns:
- list of user's roles
- Throws:
AuthOpException- Exception thrown on error.
-
isUserInRole
Description copied from interface:AuthnOpsTest if the user represented by request has the given role.- Specified by:
isUserInRolein interfaceAuthnOps- 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.
-