Search in sources :

Example 26 with SMSException

use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.

the class NamingService method initialize.

public static void initialize() {
    namingDebug = Debug.getInstance("amNaming");
    platformProperties = SystemProperties.getAll();
    server_proto = platformProperties.getProperty("com.iplanet.am.server.protocol", "");
    server_host = platformProperties.getProperty("com.iplanet.am.server.host", "");
    server_port = platformProperties.getProperty(Constants.AM_SERVER_PORT, "");
    PrivilegedAction<SSOToken> adminAction = InjectorHolder.getInstance(Key.get(new TypeLiteral<PrivilegedAction<SSOToken>>() {
    }));
    sso = AccessController.doPrivileged(adminAction);
    try {
        ssmNaming = new ServiceSchemaManager(NAMING_SERVICE, sso);
        ssmPlatform = new ServiceSchemaManager(PLATFORM_SERVICE, sso);
        serviceRevNumber = ssmPlatform.getRevisionNumber();
    } catch (SMSException | SSOException e) {
        throw new IllegalStateException(e);
    }
    ServiceListeners.Action action = new ServiceListeners.Action() {

        @Override
        public void performUpdate() {
            try {
                updateNamingTable();
                WebtopNaming.updateNamingTable();
            } catch (Exception ex) {
                namingDebug.error("Error occured in updating naming table", ex);
            }
        }
    };
    ServiceListeners builder = InjectorHolder.getInstance(ServiceListeners.class);
    builder.config(NAMING_SERVICE).global(action).schema(action).listen();
    builder.config(PLATFORM_SERVICE).global(action).schema(action).listen();
}
Also used : ServiceListeners(com.iplanet.services.naming.ServiceListeners) PrivilegedAction(java.security.PrivilegedAction) SSOToken(com.iplanet.sso.SSOToken) TypeLiteral(com.google.inject.TypeLiteral) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) ServerEntryNotFoundException(com.iplanet.services.naming.ServerEntryNotFoundException) SMSException(com.sun.identity.sm.SMSException) MalformedURLException(java.net.MalformedURLException) SSOException(com.iplanet.sso.SSOException)

Example 27 with SMSException

use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.

the class ConfiguredSocialAuthServices method filterConfigs.

@Override
protected Set<String> filterConfigs(Set<String> namedConfigs, ServiceConfig parentConfig, String realm, SSOToken adminToken) {
    AMAuthenticationManager authMgr;
    try {
        authMgr = new AMAuthenticationManager(adminToken, realm);
    } catch (AMConfigurationException e) {
        debug.warning("Could not load authentication manager for realm: " + realm, e);
        return Collections.EMPTY_SET;
    }
    Set<String> configs = new TreeSet<String>();
    for (String config : namedConfigs) {
        try {
            ServiceConfig authConfig = parentConfig.getSubConfig(config);
            Set<String> chainConfig = (Set<String>) authConfig.getAttributes().get(AMAuthConfigUtils.ATTR_NAME);
            AppConfigurationEntry[] chain = AMAuthConfigUtils.parseValues(chainConfig.iterator().next());
            for (int i = 0; i < chain.length; i++) {
                if (getType(authMgr, chain[i]).equals(OAUTH2_TYPE)) {
                    // There's an OAuth2 module in the chain, so this could be a social authn chain
                    configs.add(config);
                }
            }
        } catch (SMSException e) {
            if (debug.messageEnabled()) {
                debug.message("Not using auth chain as couldn't get config: " + config, e);
            }
        } catch (SSOException e) {
            if (debug.warningEnabled()) {
                debug.warning("Invalid SSO Token when trying to get config for " + config, e);
            }
        }
    }
    return configs;
}
Also used : AppConfigurationEntry(javax.security.auth.login.AppConfigurationEntry) Set(java.util.Set) TreeSet(java.util.TreeSet) ServiceConfig(com.sun.identity.sm.ServiceConfig) SMSException(com.sun.identity.sm.SMSException) TreeSet(java.util.TreeSet) AMConfigurationException(com.sun.identity.authentication.config.AMConfigurationException) SSOException(com.iplanet.sso.SSOException) AMAuthenticationManager(com.sun.identity.authentication.config.AMAuthenticationManager)

Example 28 with SMSException

use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.

the class AgentDumpModelImpl method getAttributeValues.

public Map getAttributeValues(String universalId) throws AMConsoleException {
    try {
        AMIdentity amid = IdUtils.getIdentity(adminSSOToken, universalId);
        Map values = AgentConfiguration.getAgentAttributes(amid, true);
        return values;
    } catch (IdRepoException re) {
        throw new AMConsoleException(re.getMessage());
    } catch (SMSException se) {
        throw new AMConsoleException(se.getMessage());
    } catch (SSOException ssoe) {
        throw new AMConsoleException(ssoe.getMessage());
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) Map(java.util.Map)

Example 29 with SMSException

use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.

the class AgentsModelImpl method updateAgentConfigInheritance.

/**
     * Updates inheritance setting.
     *
     * @param universalId Universal ID of the agent.
     * @param inherit Map of attribute name to either "1" or "0". "1" to 
     *        inherit and "0" not.
     * @throws AMConsoleException if update failed.
     */
public void updateAgentConfigInheritance(String universalId, Map inherit) throws AMConsoleException {
    try {
        AMIdentity amid = IdUtils.getIdentity(getUserSSOToken(), universalId);
        AgentConfiguration.updateInheritance(amid, inherit);
    } catch (SMSException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (SSOException e) {
        throw new AMConsoleException(getErrorString(e));
    } catch (IdRepoException e) {
        throw new AMConsoleException(getErrorString(e));
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) AMIdentity(com.sun.identity.idm.AMIdentity) IdRepoException(com.sun.identity.idm.IdRepoException) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException)

Example 30 with SMSException

use of com.sun.identity.sm.SMSException in project OpenAM by OpenRock.

the class AgentsModelImpl method getDiscoveryConfigurations.

/**
     * Returns map of discovery configurations.
     *
     * @return map of discovery configurations.
     * @throws AMConsoleException if discovery configurations cannot be returned.
     */
public Map getDiscoveryConfigurations() {
    try {
        Map map = AgentConfiguration.getChoiceValues("Discovery", "WSCAgent");
        if ((map != null) && !map.isEmpty()) {
            if (rbAgent != null) {
                Map localizedMap = new HashMap();
                for (Iterator i = map.keySet().iterator(); i.hasNext(); ) {
                    String k = (String) i.next();
                    localizedMap.put((String) map.get(k), Locale.getString(rbAgent, k));
                }
                return localizedMap;
            } else {
                return map;
            }
        }
    } catch (SSOException e) {
        debug.error("AgentModelImpl.getDiscoveryConfigurations", e);
    } catch (SMSException e) {
        debug.error("AgentModelImpl.getDiscoveryConfigurations", e);
    }
    return Collections.EMPTY_MAP;
}
Also used : HashMap(java.util.HashMap) SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) SSOException(com.iplanet.sso.SSOException) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

SMSException (com.sun.identity.sm.SMSException)704 SSOException (com.iplanet.sso.SSOException)525 Set (java.util.Set)272 HashSet (java.util.HashSet)200 SSOToken (com.iplanet.sso.SSOToken)185 Map (java.util.Map)166 ServiceConfig (com.sun.identity.sm.ServiceConfig)164 HashMap (java.util.HashMap)158 CLIException (com.sun.identity.cli.CLIException)149 ServiceSchema (com.sun.identity.sm.ServiceSchema)138 Iterator (java.util.Iterator)133 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)131 ServiceConfigManager (com.sun.identity.sm.ServiceConfigManager)104 IOutput (com.sun.identity.cli.IOutput)96 IdRepoException (com.sun.identity.idm.IdRepoException)86 OrganizationConfigManager (com.sun.identity.sm.OrganizationConfigManager)84 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)83 AttributeSchema (com.sun.identity.sm.AttributeSchema)66 IOException (java.io.IOException)55 List (java.util.List)51