Search in sources :

Example 21 with SSOException

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

the class DelegationConfigNode method hasPermission.

boolean hasPermission(String realmName, String serviceName, String action, SSOToken ssoToken) throws DelegationException {
    if (realmName == null) {
        try {
            realmName = DNMapper.orgNameToRealmName(ssoToken.getProperty(Constants.ORGANIZATION));
        } catch (SSOException e) {
            throw new DelegationException(e);
        }
    }
    DelegationEvaluator delegationEvaluator = new DelegationEvaluatorImpl();
    DelegationPermission delegationPermission = getDelegationPermission(realmName, action);
    boolean allowed = false;
    if (serviceName != null) {
        allowed = isAllowed(delegationEvaluator, delegationPermission, ssoToken, serviceName);
    } else {
        Set actions = (Set) permissions.get(AMAdminConstants.PERMISSION_MODIFY);
        for (Iterator i = actions.iterator(); i.hasNext() && !allowed; ) {
            allowed = isAllowed(delegationEvaluator, delegationPermission, ssoToken, (String) i.next());
        }
    }
    return allowed;
}
Also used : DelegationEvaluatorImpl(com.sun.identity.delegation.DelegationEvaluatorImpl) Set(java.util.Set) HashSet(java.util.HashSet) Iterator(java.util.Iterator) DelegationEvaluator(com.sun.identity.delegation.DelegationEvaluator) SSOException(com.iplanet.sso.SSOException) DelegationException(com.sun.identity.delegation.DelegationException) DelegationPermission(com.sun.identity.delegation.DelegationPermission)

Example 22 with SSOException

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

the class AccessControlModelImpl method getServiceNames.

private Set getServiceNames() {
    if (serviceNames == null) {
        SSOToken adminSSOToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
        try {
            ServiceManager sm = new ServiceManager(adminSSOToken);
            serviceNames = sm.getServiceNames();
        } catch (SSOException e) {
            AMModelBase.debug.error("AccessControlModelImpl.getServiceNames", e);
        } catch (SMSException e) {
            AMModelBase.debug.error("AccessControlModelImpl.getServiceNames", e);
        }
    }
    return serviceNames;
}
Also used : SSOToken(com.iplanet.sso.SSOToken) SMSException(com.sun.identity.sm.SMSException) ServiceManager(com.sun.identity.sm.ServiceManager) SSOException(com.iplanet.sso.SSOException)

Example 23 with SSOException

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

the class TabControllerBase method updateStatus.

protected void updateStatus() {
    boolean status = false;
    SSOToken adminSSOToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    try {
        ServiceSchemaManager mgr = new ServiceSchemaManager(AMAdminConstants.ADMIN_CONSOLE_SERVICE, adminSSOToken);
        ServiceSchema schema = mgr.getSchema(SchemaType.GLOBAL);
        AttributeSchema as = schema.getAttributeSchema(getConfigAttribute());
        Set defaultValue = as.getDefaultValues();
        if ((defaultValue != null) && !defaultValue.isEmpty()) {
            String val = (String) defaultValue.iterator().next();
            status = (val != null) && val.equals("true");
        }
    } catch (SMSException e) {
        AMModelBase.debug.error("TabControllerBase.updateStatus", e);
    } catch (SSOException e) {
        AMModelBase.debug.error("TabControllerBase.updateStatus", e);
    }
    visible = status;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) SSOToken(com.iplanet.sso.SSOToken) Set(java.util.Set) SMSException(com.sun.identity.sm.SMSException) AttributeSchema(com.sun.identity.sm.AttributeSchema) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager)

Example 24 with SSOException

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

the class SubConfigMeta method deleteSubConfigurations.

/**
     * Deletes sub configurations.
     *
     * @param names Set of sub configuration names that are to be deleted.
     * @throws AMConsoleException if sub configurations cannot be deleted.
     */
public void deleteSubConfigurations(Set names) throws AMConsoleException {
    String curName = null;
    try {
        if (parentConfig != null) {
            String[] params = new String[3];
            params[0] = serviceName;
            params[1] = parentConfig.getComponentName();
            for (Iterator iter = names.iterator(); iter.hasNext(); ) {
                curName = (String) iter.next();
                params[2] = curName;
                amModel.logEvent("ATTEMPT_DELETE_GLOBAL_SUB_CONFIGURATION", params);
                parentConfig.removeSubConfig(curName);
                removeFromSubConfigList(curName);
                amModel.logEvent("SUCCEED_DELETE_GLOBAL_SUB_CONFIGURATION", params);
            }
        }
    } catch (SSOException e) {
        String[] paramsEx = { serviceName, parentConfig.getComponentName(), curName, amModel.getErrorString(e) };
        amModel.logEvent("SSO_EXCEPTION_DELETE_GLOBAL_SUB_CONFIGURATION", paramsEx);
        throw new AMConsoleException(amModel.getErrorString(e));
    } catch (SMSException e) {
        String[] paramsEx = { serviceName, parentConfig.getComponentName(), curName, amModel.getErrorString(e) };
        amModel.logEvent("SMS_EXCEPTION_DELETE_GLOBAL_SUB_CONFIGURATION", paramsEx);
        throw new AMConsoleException(amModel.getErrorString(e));
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) SSOException(com.iplanet.sso.SSOException)

Example 25 with SSOException

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

the class SubConfigMeta method setParentId.

public void setParentId(String parentId) {
    if (validInstance()) {
        resetMeta();
        try {
            getCorrespondingSchema(parentId);
            getSupportedGlobalSubSchema();
            if ((globalSubSchemaNames != null) && !globalSubSchemaNames.isEmpty()) {
                creatableGlobalSubSchemas = new HashSet();
                creatableGlobalSubSchemas.addAll(globalSubSchemaNames);
                getSubConfigurationsFromConfig();
            }
        } catch (SSOException e) {
            AMModelBase.debug.error("SubConfigMeta.getParentId", e);
        } catch (SMSException e) {
            AMModelBase.debug.error("SubConfigMeta.getParentId", e);
        }
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) HashSet(java.util.HashSet)

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