use of org.alfresco.filesys.AlfrescoConfigSection in project alfresco-repository by Alfresco.
the class AlfrescoRpcAuthenticator method initialize.
/**
* Initialize the RPC authenticator
*
* @param config ServerConfiguration
* @param params NameValueList
* @throws InvalidConfigurationException
*/
public void initialize(ServerConfiguration config, ConfigElement params) throws InvalidConfigurationException {
// Get the alfresco configuration section, required to get hold of various services/components
AlfrescoConfigSection alfrescoConfig = (AlfrescoConfigSection) config.getConfigSection(AlfrescoConfigSection.SectionName);
// Copy over relevant bean properties for backward compatibility
setAuthenticationComponent(alfrescoConfig.getAuthenticationComponent());
setAuthenticationService((MutableAuthenticationService) alfrescoConfig.getAuthenticationService());
setTransactionService(alfrescoConfig.getTransactionService());
// Check for the user mappings
ConfigElement userMappings = params.getChild("userMappings");
if (userMappings != null) {
// Allocate the id mappings table
List<UserMapping> mappings = new LinkedList<UserMapping>();
// Get the user map elements
List<ConfigElement> userMaps = userMappings.getChildren();
for (ConfigElement userElem : userMaps) {
if (userElem.getName().equalsIgnoreCase("user")) {
// Get the user name, user id and group id
String userName = userElem.getAttribute("name");
String uidStr = userElem.getAttribute("uid");
String gidStr = userElem.getAttribute("gid");
if (userName == null || userName.length() == 0)
throw new InvalidConfigurationException("Empty user name, or name not specified");
if (uidStr == null || uidStr.length() == 0)
throw new InvalidConfigurationException("Invalid uid, or uid not specified, for user " + userName);
if (gidStr == null || gidStr.length() == 0)
throw new InvalidConfigurationException("Invalid gid, or gid not specified, for user " + userName);
// Parse the uid/gid
int uid = -1;
int gid = -1;
try {
uid = Integer.parseInt(uidStr);
} catch (NumberFormatException ex) {
throw new InvalidConfigurationException("Invalid uid value, " + uidStr + " for user " + userName);
}
try {
gid = Integer.parseInt(gidStr);
} catch (NumberFormatException ex) {
throw new InvalidConfigurationException("Invalid gid value, " + gidStr + " for user " + userName);
}
mappings.add(new UserMapping(userName, uid, gid));
}
}
setUserMappings(mappings);
}
afterPropertiesSet();
}
use of org.alfresco.filesys.AlfrescoConfigSection in project alfresco-repository by Alfresco.
the class FTPAuthenticatorBase method initialize.
/**
* Initialize the authenticator
*
* @param config ServerConfiguration
* @param params ConfigElement
* @exception InvalidConfigurationException
*/
public void initialize(ServerConfiguration config, ConfigElement params) throws InvalidConfigurationException {
setConfig(config);
// Get the alfresco configuration section, required to get hold of various services/components
AlfrescoConfigSection alfrescoConfig = (AlfrescoConfigSection) config.getConfigSection(AlfrescoConfigSection.SectionName);
// Copy over relevant bean properties for backward compatibility
setAuthenticationComponent(alfrescoConfig.getAuthenticationComponent());
setAuthenticationService(alfrescoConfig.getAuthenticationService());
setTransactionService(alfrescoConfig.getTransactionService());
setAuthorityService(alfrescoConfig.getAuthorityService());
// Complete initialization
initialize();
}
Aggregations