Search in sources :

Example 96 with SSOException

use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.

the class SmsCollectionProvider method updateInstance.

/**
     * Updates a child instance of config. The parent config referenced by the request path is found, and
     * the config is updated using the resourceId.
     * {@inheritDoc}
     */
@Override
public Promise<ResourceResponse, ResourceException> updateInstance(Context context, String resourceId, UpdateRequest request) {
    JsonValue content = request.getContent();
    String realm = realmFor(context);
    try {
        Map<String, Set<String>> attrs = converter.fromJson(realm, content);
        ServiceConfigManager scm = getServiceConfigManager(context);
        ServiceConfig config = parentSubConfigFor(context, scm);
        ServiceConfig node = checkedInstanceSubConfig(context, resourceId, config);
        node.setAttributes(attrs);
        JsonValue result = getJsonValue(realm, node);
        return newResultPromise(newResourceResponse(resourceId, String.valueOf(result.hashCode()), result));
    } catch (ServiceNotFoundException e) {
        debug.warning("::SmsCollectionProvider:: ServiceNotFoundException on update", e);
        return new NotFoundException("Unable to update SMS config: " + e.getMessage()).asPromise();
    } catch (SMSException e) {
        debug.warning("::SmsCollectionProvider:: SMSException on update", e);
        return new InternalServerErrorException("Unable to update SMS config: " + e.getMessage()).asPromise();
    } catch (SSOException e) {
        debug.warning("::SmsCollectionProvider:: SSOException on update", e);
        return new InternalServerErrorException("Unable to update SMS config: " + e.getMessage()).asPromise();
    } catch (ResourceException e) {
        return e.asPromise();
    }
}
Also used : TreeSet(java.util.TreeSet) Set(java.util.Set) ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) ServiceNotFoundException(com.sun.identity.sm.ServiceNotFoundException) JsonValue(org.forgerock.json.JsonValue) NotFoundException(org.forgerock.json.resource.NotFoundException) ServiceNotFoundException(com.sun.identity.sm.ServiceNotFoundException) InternalServerErrorException(org.forgerock.json.resource.InternalServerErrorException) SSOException(com.iplanet.sso.SSOException) ResourceException(org.forgerock.json.resource.ResourceException) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Example 97 with SSOException

use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.

the class SitesResourceProvider method readInstance.

@Override
public Promise<ResourceResponse, ResourceException> readInstance(Context context, String id, ReadRequest request) {
    try {
        SSOToken token = getSsoToken(context);
        ResourceResponse site = getSite(token, id);
        return newResultPromise(site);
    } catch (SMSException | SSOException | ConfigurationException e) {
        debug.error("Could not read site {}", id, e);
        return new InternalServerErrorException("Could not read site").asPromise();
    } catch (NotFoundException e) {
        return e.asPromise();
    }
}
Also used : SSOToken(com.iplanet.sso.SSOToken) ResourceResponse(org.forgerock.json.resource.ResourceResponse) SMSException(com.sun.identity.sm.SMSException) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException) InternalServerErrorException(org.forgerock.json.resource.InternalServerErrorException) NotFoundException(org.forgerock.json.resource.NotFoundException) SSOException(com.iplanet.sso.SSOException)

Example 98 with SSOException

use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.

the class ComplianceServicesImpl method isComplianceUserDeletionEnabled.

/**
     * Method which checks if Compliance User Deletion is enabled
     * 
     * @return true if Compliance User Deletion is enabled
     * @exception AMException
     *                if an error is encountered
     */
public static boolean isComplianceUserDeletionEnabled() throws AMException {
    try {
        if (gsc == null) {
            ServiceSchemaManager scm = new ServiceSchemaManager(ADMINISTRATION_SERVICE, internalToken);
            gsc = scm.getGlobalSchema();
        }
        Map attrMap = gsc.getReadOnlyAttributeDefaults();
        Set values = (Set) attrMap.get(COMPLIANCE_USER_DELETION_ATTR);
        boolean enabled = false;
        if (values == null || values.isEmpty()) {
            enabled = false;
        } else {
            String val = (String) values.iterator().next();
            enabled = (val.equalsIgnoreCase("true"));
        }
        if (debug.messageEnabled()) {
            debug.message("Compliance.isComplianceUserDeletionEnabled = " + enabled);
        }
        return enabled;
    } catch (SMSException ex) {
        debug.error(AMSDKBundle.getString("359"), ex);
        throw new AMException(AMSDKBundle.getString("359"), "359");
    } catch (SSOException ex) {
        debug.error(AMSDKBundle.getString("359"), ex);
        throw new AMException(AMSDKBundle.getString("359"), "359");
    }
}
Also used : HashSet(java.util.HashSet) AttrSet(com.iplanet.services.ldap.AttrSet) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) AMException(com.iplanet.am.sdk.AMException) SSOException(com.iplanet.sso.SSOException) HashMap(java.util.HashMap) Map(java.util.Map) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 99 with SSOException

use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.

the class CommonUtils method populateManagedObjects.

protected static boolean populateManagedObjects() {
    try {
        ServiceConfigManager scm = new ServiceConfigManager("DAI", getInternalToken());
        ServiceConfig gc = scm.getGlobalConfig(null);
        Set managedObjects = gc.getSubConfigNames("*", "ManagedObjects");
        if (managedObjects == null || managedObjects.isEmpty()) {
            debug.message("CommonUtils.populateManagedObject " + "managedObjects=null");
            return false;
        // populateManagedObjectsWithDefaults();
        }
        Iterator mIter = managedObjects.iterator();
        while (mIter.hasNext()) {
            String mo = (String) mIter.next();
            mo = mo.toLowerCase();
            ServiceConfig sc = gc.getSubConfig(mo);
            if (sc != null) {
                Map attrs = sc.getAttributes();
                Set ocSet = (Set) attrs.get("objectclass");
                Set ctSet = (Set) attrs.get("creationtemplatename");
                Set stSet = (Set) attrs.get("searchtemplatename");
                Set typeSet = (Set) attrs.get("type");
                Set stAttr = (Set) attrs.get("statusattribute");
                String oc = getObjectClass(ocSet, mo);
                String ct = getCreationTemplateName(ctSet, mo);
                String st = getSearchTemplateName(stSet, mo);
                String stAttrName = getStatusAttributeName(stAttr);
                // Assumes a type is always defined in the config.
                // TODO be careful with NPE here.
                String typeS = (String) typeSet.iterator().next();
                // int type = Integer.parseInt(typeS);
                supportedTypes.put(mo, typeS);
                supportedNames.put(typeS, mo);
                if (oc != null) {
                    ObjectClassManager.objectClassMap.put(typeS, oc);
                    ObjectClassManager.objectTypeMap.put(oc, typeS);
                }
                if (st != null)
                    searchtemplateMap.put(typeS, st);
                if (ct != null)
                    creationtemplateMap.put(typeS, ct);
                if (stAttrName != null)
                    statusAttributeMap.put(typeS, stAttrName);
            }
        }
        if (debug.messageEnabled()) {
            debug.message("CreationTemplate MAP = " + creationtemplateMap.toString());
            debug.message("SearchTemplate Map = " + searchtemplateMap.toString());
            debug.message("ObjectClass-Type Map = " + ObjectClassManager.objectClassMap.toString());
            debug.message("Type-ObjectClass MAP = " + ObjectClassManager.objectTypeMap.toString());
            debug.message("Supported names-type = " + supportedTypes.toString());
            debug.message("Status Attributes= " + statusAttributeMap.toString());
        }
    } catch (SMSException se) {
        return false;
    // populateManagedObjectsWithDefaults();
    } catch (SSOException ssoe) {
        return false;
    // populateManagedObjectsWithDefaults();
    }
    return true;
}
Also used : AttrSet(com.iplanet.services.ldap.AttrSet) Set(java.util.Set) HashSet(java.util.HashSet) ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) SSOException(com.iplanet.sso.SSOException) AMHashMap(com.iplanet.am.sdk.AMHashMap) HashMap(java.util.HashMap) Map(java.util.Map) ServiceConfigManager(com.sun.identity.sm.ServiceConfigManager)

Example 100 with SSOException

use of com.iplanet.sso.SSOException in project OpenAM by OpenRock.

the class EventService method isAMSDKConfigured.

private static boolean isAMSDKConfigured() {
    boolean isAMSDKConfigured = false;
    boolean configTime = isDuringConfigurationTime();
    logger.message("EventService.getListenerList(): {}: {}", Constants.SYS_PROPERTY_INSTALL_TIME, configTime);
    if (!configTime) {
        try {
            ServiceSchemaManager scm = new ServiceSchemaManager(AccessController.doPrivileged(AdminTokenAction.getInstance()), IdConstants.REPO_SERVICE, "1.0");
            ServiceSchema idRepoSubSchema = scm.getOrganizationSchema();
            Set idRepoPlugins = idRepoSubSchema.getSubSchemaNames();
            if (idRepoPlugins.contains("amSDK")) {
                isAMSDKConfigured = true;
            }
        } catch (SMSException ex) {
            logger.warning("EventService.getListenerList() - Unable to obtain idrepo service", ex);
        } catch (SSOException ex) {
        // Should not happen, ignore the exception
        }
    }
    return isAMSDKConfigured;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Aggregations

SSOException (com.iplanet.sso.SSOException)1002 SMSException (com.sun.identity.sm.SMSException)553 Set (java.util.Set)374 SSOToken (com.iplanet.sso.SSOToken)336 IdRepoException (com.sun.identity.idm.IdRepoException)291 HashSet (java.util.HashSet)289 Map (java.util.Map)223 HashMap (java.util.HashMap)205 AMIdentity (com.sun.identity.idm.AMIdentity)193 Iterator (java.util.Iterator)189 CLIException (com.sun.identity.cli.CLIException)170 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)126 ServiceConfig (com.sun.identity.sm.ServiceConfig)126 IOutput (com.sun.identity.cli.IOutput)121 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)104 ServiceSchema (com.sun.identity.sm.ServiceSchema)101 ServiceConfigManager (com.sun.identity.sm.ServiceConfigManager)93 AMIdentityRepository (com.sun.identity.idm.AMIdentityRepository)88 IOException (java.io.IOException)65 PolicyException (com.sun.identity.policy.PolicyException)62