uk.org.ogsadai.common.rolemap
Class SimpleFileRoleMapper
java.lang.Object
|
+--uk.org.ogsadai.common.rolemap.SimpleFileRoleMapper
- All Implemented Interfaces:
- RoleMapper
- public class SimpleFileRoleMapper
- extends java.lang.Object
- implements RoleMapper
A component that maps user security credentials to database user names and passwords. The mappings are provided in an OGSA-DAI role map file.
Mappings are maintained for one or more databases.
The file is assumed to conform to the OGSA-DAI schema OGSA-DAI/schema/ogsadai/xsd/rolemap/role_map.xsd
.
- Author:
- The OGSA-DAI Project Team
Method Summary |
private void |
addDatabaseRoles(java.lang.String databaseName, org.w3c.dom.NodeList userList)
Adds a set of mappings from user security credentials to user names and passwords for a database. |
Role |
map(java.lang.String credentials, java.lang.String database)
Maps the given credentials and database onto a role which can be used to access the database. |
void |
setConfiguration(java.lang.String fileName)
Read a set of mappings, for one or more databases, from user security credentials to user names and passwords. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
COPYRIGHT_NOTICE
private static final java.lang.String COPYRIGHT_NOTICE
-
- See Also:
- Constant Field Values
LOG
private static DAILogger LOG
-
WILDCARD
private static final java.lang.String WILDCARD
-
- See Also:
- Constant Field Values
VALIDATE
private static boolean VALIDATE
-
mDBHash
private java.util.Map mDBHash
-
SimpleFileRoleMapper
public SimpleFileRoleMapper()
setConfiguration
public void setConfiguration(java.lang.String fileName)
throws RoleMapConfigurationException
-
Read a set of mappings, for one or more databases, from user security credentials to user names and passwords.
-
- Specified by:
setConfiguration
in interface RoleMapper
-
- Parameters:
fileName
- Role map file location.
- Throws:
RoleMapConfigurationException
- if there are problems in configuring the role maps.
- See Also:
RoleMapper.setConfiguration(java.lang.String)
addDatabaseRoles
private void addDatabaseRoles(java.lang.String databaseName,
org.w3c.dom.NodeList userList)
-
Adds a set of mappings from user security credentials to user names and passwords for a database.
-
-
- Parameters:
databaseName
- Name of database to which these mappings correspond.
userList
- Node from the role map file for the database and which is parsed to get the mappings.
map
public Role map(java.lang.String credentials,
java.lang.String database)
throws RoleMapAuthorizationException,
RoleMapCannotAuthorizeException
- Description copied from interface:
RoleMapper
-
Maps the given credentials and database onto a role which can be used to access the database.
-
- Specified by:
map
in interface RoleMapper
-
- Parameters:
credentials
- User credentials.
database
- URI of database to get role for.
- Returns:
- the role to use to access the database.
- Throws:
RoleMapCannotAuthorizeException
- if a problem arises during the authorization.
RoleMapAuthorizationException
- if the user is not authorized to access the database.