use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AuthUtils method getGlobalAttributes.
/**
* Returns <code>Map</code> attributes
*
* @param serviceName Service Name
* @return <code>Map</code> of global attributes.
*/
public static Map getGlobalAttributes(String serviceName) {
Map attrs = null;
try {
SSOToken dUserToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
ServiceSchemaManager scm = new ServiceSchemaManager(serviceName, dUserToken);
ServiceSchema schema = scm.getGlobalSchema();
if (schema != null) {
attrs = schema.getAttributeDefaults();
}
} catch (SMSException smsExp) {
utilDebug.error("AuthUtils.getGlobalAttributes: SMS Error", smsExp);
} catch (SSOException ssoExp) {
utilDebug.error("AuthUtils.getGlobalAttributes: SSO Error", ssoExp);
}
if (utilDebug.messageEnabled()) {
utilDebug.message("AuthUtils.getGlobalAttributes: attrs=" + attrs);
}
return attrs;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AuthD method updateAuthServiceGlobals.
/**
* Update the AuthService global and organization settings.
* most of the code is moved in from AuthenticatorManager.java.
* @param scm <code>ServiceSchemaManager</code> to be used for update
* @throws SMSException if it fails to update auth service
* @throws Exception
*/
synchronized void updateAuthServiceGlobals(ServiceSchemaManager scm) throws Exception {
ServiceSchema schema = scm.getOrganizationSchema();
Map attrs = schema.getAttributeDefaults();
// get Global type attributes for iPlanetAMAuthService
schema = scm.getGlobalSchema();
attrs.putAll(schema.getAttributeDefaults());
if (debug.messageEnabled()) {
debug.message("attrs : " + attrs);
}
adminAuthModule = CollectionHelper.getMapAttr(attrs, ISAuthConstants.ADMIN_AUTH_MODULE);
defaultAuthLevel = CollectionHelper.getMapAttr(attrs, ISAuthConstants.DEFAULT_AUTH_LEVEL, DEFAULT_AUTH_LEVEL);
Set s = (Set) attrs.get(ISAuthConstants.AUTHENTICATORS);
for (final Object value : s) {
String name = (String) value;
int dot = name.lastIndexOf('.');
if (dot > -1) {
String tmp = name.substring(dot + 1, name.length());
authMethods.put(tmp, name);
} else {
authMethods.put(name, name);
}
}
if (debug.messageEnabled()) {
debug.message("AM.update authMethods = " + authMethods.toString());
}
defaultSuccessURLSet = (Set) attrs.get(ISAuthConstants.LOGIN_SUCCESS_URL);
defaultFailureURLSet = (Set) attrs.get(ISAuthConstants.LOGIN_FAILURE_URL);
if (debug.messageEnabled()) {
debug.message("Default Success URL Set = " + defaultSuccessURLSet);
debug.message("Default Failure URL Set = " + defaultFailureURLSet);
}
Integer sleepTime = new Integer(CollectionHelper.getMapAttr(attrs, ISAuthConstants.SLEEP_INTERVAL));
defaultSleepTime = sleepTime.longValue();
}
use of com.sun.identity.sm.ServiceSchema 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;
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AbstractAuditModel method getAddEventHandlerPropertyXML.
/**
* Get the JATO XML configuration for generation the UI used to add event handlers.
*
* @param schemaId The event handler schema ID.
* @return The JATO XML configuration for generation the UI.
* @throws AMConsoleException If an error occurs during the XML creation.
*/
public String getAddEventHandlerPropertyXML(String schemaId) throws AMConsoleException {
try {
ServiceSchema handlerSchema = getServiceSchema().getSubSchema(schemaId);
updateHandlerResourceBundle(handlerSchema);
xmlBuilder = new PropertyXMLBuilder(handlerSchema, this, handlerResourceBundle, getSectionsForHandler(schemaId), schemaId + SECTION_FILE_NAME_SUFFIX);
xmlBuilder.setSupportSubConfig(false);
String xml = xmlBuilder.getXML();
String attributeNameXML = AMAdminUtils.getStringFromInputStream(getClass().getClassLoader().getResourceAsStream("com/sun/identity/console/propertyAuditEventHandlerName.xml"));
return PropertyXMLBuilder.prependXMLProperty(xml, attributeNameXML);
} catch (SMSException | SSOException e) {
throw new AMConsoleException(getErrorString(e));
}
}
use of com.sun.identity.sm.ServiceSchema in project OpenAM by OpenRock.
the class AbstractAuditModel method getEventHandlerDefaultValues.
/**
* Get the default attribute values for the specified event handler type (schema ID).
*
* @param eventHandlerType The name of the event handler type.
* @return A map of default event handler attribute values.
* @throws AMConsoleException If an error occurs whilst reading the attributes.
*/
public Map<String, Set<?>> getEventHandlerDefaultValues(String eventHandlerType) throws AMConsoleException {
try {
Map<String, Set<?>> defaultValues = new HashMap<>();
ServiceSchema handlerSchema = getServiceSchema().getSubSchema(eventHandlerType);
Set attributeSchemas = handlerSchema.getAttributeSchemas();
for (Object value : attributeSchemas) {
AttributeSchema as = (AttributeSchema) value;
Set values = as.getDefaultValues();
if (values != null) {
defaultValues.put(as.getName(), values);
}
}
return defaultValues;
} catch (SSOException | SMSException e) {
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations