use of com.iplanet.ums.Guid in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createResource.
private void createResource(PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.RESOURCE), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicResource", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
com.iplanet.ums.Resource resource = new com.iplanet.ums.Resource(creationTemp, attrSet);
parentObj.addChild(resource);
}
use of com.iplanet.ums.Guid in project OpenAM by OpenRock.
the class DirectoryServicesImpl method setGroupFilter.
/**
* Sets the filter for a dynamic group in the datastore.
*
* @param token
* @param entryDN
* @param filter
* @throws AMException
* @throws SSOException
*/
public void setGroupFilter(SSOToken token, String entryDN, String filter) throws AMException, SSOException {
try {
DynamicGroup dynamicGroup = (DynamicGroup) UMSObject.getObject(token, new Guid(entryDN));
dynamicGroup.setSearchFilter(filter);
dynamicGroup.save();
} catch (UMSException ume) {
debug.message("AMDynamicGroup.setSearchFilter() - Unable to " + "setFilter()", ume);
throw new AMException(token, "352", ume);
}
}
use of com.iplanet.ums.Guid in project OpenAM by OpenRock.
the class DirectoryServicesImpl method createRole.
private void createRole(SSOToken token, PersistentObject parentObj, Map attributes, String profileName) throws UMSException, AMException {
// Invoke the Pre Processing plugin
String orgDN = getOrganizationDN(internalToken, parentObj.getDN());
String entryDN = getNamingAttribute(AMObject.ROLE) + "=" + profileName + "," + parentObj.getDN();
attributes = callBackHelper.preProcess(token, entryDN, orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ROLE, false);
AttrSet attrSet = CommonUtils.mapToAttrSet(attributes);
makeNamingFirst(attrSet, getNamingAttribute(AMObject.ROLE), profileName);
TemplateManager tempMgr = TemplateManager.getTemplateManager();
CreationTemplate creationTemp = tempMgr.getCreationTemplate("BasicManagedRole", new Guid(orgDN), TemplateManager.SCOPE_ANCESTORS);
attrSet = combineOCs(creationTemp, attrSet);
com.iplanet.ums.ManagedRole role = new com.iplanet.ums.ManagedRole(creationTemp, attrSet);
parentObj.addChild(role);
// Invoke Post processing impls
callBackHelper.postProcess(token, role.getDN(), orgDN, null, attributes, CallBackHelper.CREATE, AMObject.ROLE, false);
}
use of com.iplanet.ums.Guid in project OpenAM by OpenRock.
the class DCTreeServicesImpl method getDomainAttributes.
protected AttrSet getDomainAttributes(SSOToken token, String orgDN, String[] attrNames) throws AMException, SSOException {
String domainName = null;
try {
AttrSet domAttrSet;
domainName = getCanonicalDomain(token, orgDN);
if (domainName == null) {
debug.error("DCTree.getDomainAttributes-> " + "Domain not found for: " + orgDN);
return null;
}
DomainComponentTree dcTree = new DomainComponentTree(token, new Guid(DCTREE_START_DN));
DomainComponent dcNode = dcTree.getDomainComponent(domainName);
if (attrNames != null) {
domAttrSet = dcNode.getAttributes(attrNames);
} else {
domAttrSet = dcNode.getAttributes(dcNode.getAttributeNames());
}
AttrSet[] attrArray = splitAttrSet(null, domAttrSet);
return attrArray[1];
} catch (UMSException umse) {
debug.error("DCTree.getDomainAttributes: " + " error getting attributes for domain " + domainName);
}
return null;
}
use of com.iplanet.ums.Guid in project OpenAM by OpenRock.
the class ServerConfigMgr method changePassword.
/**
* Checks and sets the password
*/
private void changePassword(String userType, String oldPassword, String newPassword) throws Exception {
String fileEncPassword = getUserPassword(userType);
String userDN = getUserDN(userType);
if ((fileEncPassword == null) || (fileEncPassword.length() == 0) || (userDN == null) || (userDN.length() == 0)) {
debug.error("Null password or user DN for user type: " + userType + " from file: " + configFile);
throw new XMLException(i18n.getString("dscfg-corrupted-serverconfig"));
}
// Verify old password
if (!oldPassword.equals(AccessController.doPrivileged(new DecodeAction(fileEncPassword)))) {
throw new Exception(i18n.getString("dscfg-old-passwd-donot-match"));
}
if (isAMSDKConfigured) {
// this is to check if updating of DS is required.
try {
new AuthContext(new AuthPrincipal(userDN), newPassword.toCharArray());
if (debug.messageEnabled()) {
debug.message("DN: " + userDN + " new password is already updated in the directory");
}
} catch (LoginException lee) {
try {
AuthContext ac = new AuthContext(new AuthPrincipal(userDN), oldPassword.toCharArray());
PersistentObject user = UMSObject.getObject(ac.getSSOToken(), new Guid(userDN));
if (debug.messageEnabled()) {
debug.message("For DN: " + userDN + " changing password in directory");
}
user.setAttribute(new Attr("userPassword", newPassword));
user.save();
} catch (LoginException le) {
if (debug.warningEnabled()) {
debug.warning("For DN: " + userDN + " new and old passwords donot match with directory");
}
throw new Exception(i18n.getString("dscfg-invalid-password") + "\n" + le.getMessage());
}
}
}
setUserPassword(userType, newPassword);
}
Aggregations