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();
}
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;
}
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());
}
}
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));
}
}
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;
}
Aggregations