use of com.iplanet.am.sdk.AMTemplate in project OpenAM by OpenRock.
the class EmailNotificationHelper method getOrgTypeAttributes.
/**
* Protected method to be used to obtain organization attribute values for a
* given serviceName and attribute name. Returns a null value if a template
* value or default value for the attribute does not exist.
*/
protected Set getOrgTypeAttributes(AMOrganization org, String serviceName, String attrName) throws SSOException {
Set attrValues = null;
try {
AMTemplate amTemplate = org.getTemplate(serviceName, AMTemplate.ORGANIZATION_TEMPLATE);
attrValues = amTemplate.getAttribute(attrName);
if (debug.messageEnabled()) {
debug.message("AMOrganizationImpl." + "getOrgTypeAttributes(): " + "obtained from org template " + serviceName + " : " + attrName + "\n" + org.getDN() + " : " + attrValues);
}
} catch (AMException ame) {
// Get default Service attribues
try {
Map defaultValues = AMServiceUtils.getServiceConfig(internalToken, ADMINISTRATION_SERVICE, SchemaType.ORGANIZATION);
attrValues = (Set) defaultValues.get(attrName);
if (debug.messageEnabled()) {
debug.message("AMOrganizationImpl." + "getOrgTypeAttributes(): " + "obtained from org defaults " + serviceName + " : " + attrName + "\n" + org.getDN() + " : " + attrValues);
}
} catch (Exception se) {
debug.warning("AMOrganizationImpl." + "getOrgTypeAttributes(): " + "Error encountered in retrieving " + "default org attrs for", se);
}
}
return attrValues;
}
use of com.iplanet.am.sdk.AMTemplate in project OpenAM by OpenRock.
the class AMAuthConfigUtils method getAllAuthModules.
/**
* Returns all supported authentication modules in an Organization
* If there are not modules configured at the Organization level
* then the authentication modules set at Global level will be returned.
*
* @param orgDN organization DN.
* @param token single sign on token.
* @return Map contains all modules, key is the module name (e.g. LDAP),
* value is the complete class name (e.g.
* <code>com.sun.identity.authentication.modules.ldap.LDAP</code>)
*/
public static Map getAllAuthModules(String orgDN, SSOToken token) {
Map modules = new HashMap();
// get auth global attribute
Set authenticators = null;
try {
AMStoreConnection dpStore = new AMStoreConnection(token);
AMOrganization org = (AMOrganization) dpStore.getOrganization(orgDN);
AMTemplate template = org.getTemplate(AUTH_SERVICE, AMTemplate.ORGANIZATION_TEMPLATE);
Map attrs = template.getAttributes();
authenticators = (Set) attrs.get(AUTH_MODULES_ATTR);
} catch (Exception e) {
debug.error("getAllAuthModules", e);
}
Set globalAuth = getGlobalAuthenticators(token);
if ((authenticators != null) && (!authenticators.isEmpty())) {
modules = constructModulesList(authenticators, globalAuth);
} else {
modules = constructModulesList(globalAuth, null);
}
if (debug.messageEnabled()) {
debug.message("Returning modules : " + modules);
}
return modules;
}
Aggregations