Search in sources :

Example 56 with Guid

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);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 57 with Guid

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);
    }
}
Also used : DynamicGroup(com.iplanet.ums.DynamicGroup) AssignableDynamicGroup(com.iplanet.ums.AssignableDynamicGroup) UMSException(com.iplanet.ums.UMSException) AMException(com.iplanet.am.sdk.AMException) Guid(com.iplanet.ums.Guid)

Example 58 with Guid

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);
}
Also used : CreationTemplate(com.iplanet.ums.CreationTemplate) ManagedRole(com.iplanet.ums.ManagedRole) TemplateManager(com.iplanet.ums.TemplateManager) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet) ManagedRole(com.iplanet.ums.ManagedRole)

Example 59 with Guid

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;
}
Also used : DomainComponent(com.iplanet.ums.dctree.DomainComponent) UMSException(com.iplanet.ums.UMSException) DomainComponentTree(com.iplanet.ums.dctree.DomainComponentTree) Guid(com.iplanet.ums.Guid) AttrSet(com.iplanet.services.ldap.AttrSet)

Example 60 with Guid

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);
}
Also used : XMLException(com.iplanet.services.util.XMLException) DecodeAction(com.sun.identity.security.DecodeAction) AuthContext(com.sun.identity.authentication.internal.AuthContext) LoginException(javax.security.auth.login.LoginException) AuthLoginException(com.sun.identity.authentication.spi.AuthLoginException) PersistentObject(com.iplanet.ums.PersistentObject) AuthPrincipal(com.sun.identity.authentication.internal.AuthPrincipal) Guid(com.iplanet.ums.Guid) LoginException(javax.security.auth.login.LoginException) FileNotFoundException(java.io.FileNotFoundException) AuthLoginException(com.sun.identity.authentication.spi.AuthLoginException) SSOException(com.iplanet.sso.SSOException) IdRepoException(com.sun.identity.idm.IdRepoException) XMLException(com.iplanet.services.util.XMLException) IOException(java.io.IOException) ConfiguratorException(com.sun.identity.setup.ConfiguratorException)

Aggregations

Guid (com.iplanet.ums.Guid)63 UMSException (com.iplanet.ums.UMSException)41 AMException (com.iplanet.am.sdk.AMException)33 PersistentObject (com.iplanet.ums.PersistentObject)29 AttrSet (com.iplanet.services.ldap.AttrSet)23 Attr (com.iplanet.services.ldap.Attr)16 CreationTemplate (com.iplanet.ums.CreationTemplate)13 TemplateManager (com.iplanet.ums.TemplateManager)13 EntryNotFoundException (com.iplanet.ums.EntryNotFoundException)11 AccessRightsException (com.iplanet.ums.AccessRightsException)10 AssignableDynamicGroup (com.iplanet.ums.AssignableDynamicGroup)9 DomainComponentTree (com.iplanet.ums.dctree.DomainComponentTree)8 AMEntryExistsException (com.iplanet.am.sdk.AMEntryExistsException)6 EntryAlreadyExistsException (com.iplanet.ums.EntryAlreadyExistsException)6 SearchResults (com.iplanet.ums.SearchResults)6 DN (org.forgerock.opendj.ldap.DN)6 LdapException (org.forgerock.opendj.ldap.LdapException)6 AMSearchResults (com.iplanet.am.sdk.AMSearchResults)5 ManagedRole (com.iplanet.ums.ManagedRole)5 OrderedSet (com.sun.identity.shared.datastruct.OrderedSet)5