use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class AuthClientUtils method getCookieDomains.
/**
* Return the set of cookie domains configured in Platform settings. Whenever possible, use
* {@link #getCookieDomainsForRequest(HttpServletRequest)} instead.
*
* @return The set of configured cookie domains. May contain null.
*/
public static Set<String> getCookieDomains() {
Set<String> cookieDomains = Collections.EMPTY_SET;
try {
SSOToken token = AccessController.doPrivileged(AdminTokenAction.getInstance());
try {
ServiceSchemaManager scm = new ServiceSchemaManager("iPlanetAMPlatformService", token);
ServiceSchema psc = scm.getGlobalSchema();
Map attrs = psc.getAttributeDefaults();
cookieDomains = (Set) attrs.get(ISAuthConstants.PLATFORM_COOKIE_DOMAIN_ATTR);
} catch (SMSException ex) {
// Ignore the exception and leave cookieDomains empty;
utilDebug.message("getCookieDomains - SMSException ");
}
if (cookieDomains == null) {
cookieDomains = Collections.singleton(null);
}
} catch (SSOException ex) {
// unable to get SSOToken
utilDebug.message("getCookieDomains - SSOException ");
}
if (utilDebug.messageEnabled() && (!cookieDomains.isEmpty())) {
StringBuilder message = new StringBuilder("CookieDomains : ");
for (String cookieDomain : cookieDomains) {
message.append(" '").append(cookieDomain).append("'");
}
utilDebug.message(message.toString());
}
return cookieDomains;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class EntitiesModelImpl method getPropertiesViewBean.
/**
* Returns properties view bean URL for an attribute schema.
*
* @param name Name of attribute schema.
* @return properties view bean URL for an attribute schema.
*/
public String getPropertiesViewBean(String name) {
String url = null;
try {
ServiceSchemaManager mgr = new ServiceSchemaManager(name, adminSSOToken);
ServiceSchema schema = mgr.getSchema(SchemaType.USER);
Set attributeSchemas = schema.getAttributeSchemas();
for (Iterator i = attributeSchemas.iterator(); i.hasNext() && (url == null); ) {
AttributeSchema as = (AttributeSchema) i.next();
if (as.getName().equals(name)) {
url = as.getPropertiesViewBeanURL();
}
}
} catch (SMSException e) {
debug.warning("EntitiesModelImpl.getDefaultValues", e);
} catch (SSOException e) {
debug.warning("EntitiesModelImpl.getDefaultValues", e);
}
return url;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class EntitiesModelImpl method hasAttributeSchema.
private boolean hasAttributeSchema(String serviceName, SchemaType type) {
boolean hasAttributes = false;
try {
ServiceSchemaManager mgr = new ServiceSchemaManager(serviceName, getUserSSOToken());
ServiceSchema schema = mgr.getSchema(type);
if (schema != null) {
Set attributeSchemas = schema.getAttributeSchemas();
if ((attributeSchemas != null) && !attributeSchemas.isEmpty()) {
hasAttributes = hasI18nKeys(attributeSchemas);
}
}
} catch (SMSException e) {
debug.warning("EntitiesModelImpl.hasAttributeSchema", e);
} catch (SSOException e) {
debug.warning("EntitiesModelImpl.hasAttributeSchema", e);
}
return hasAttributes;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class AMSDKRepo method getDefaultAgentContainerName.
private String getDefaultAgentContainerName() {
String gcName = "Agent";
try {
ServiceSchemaManager ssm = new ServiceSchemaManager(ADMIN_SERVICE, adminToken);
if (ssm != null) {
ServiceSchema ss = ssm.getGlobalSchema();
if (ss != null) {
Map attrs = ss.getAttributeDefaults();
Set vals = (Set) attrs.get(AC_ATTR);
if (vals != null && !vals.isEmpty())
gcName = (String) vals.iterator().next();
}
}
} catch (SMSException smse) {
debug.error("AMSDKRepo.getDefaultAC: SMSException: ", smse);
} catch (SSOException ssoe) {
debug.error("AMSDKRepo.getDefaultAC: SSOException", ssoe);
}
return gcName;
}
use of com.sun.identity.sm.ServiceSchemaManager in project OpenAM by OpenRock.
the class AMServiceUtils method getServiceAttributeNames.
/**
* Get attribute names for the specified Service and Schema Type
*
* @param token
* SSOToken a valid SSOToken
* @param serviceName
* the service name
* @param type
* the SchemaType
* @return the Set of attribute names for that specified Service and Schema
* Type
*/
protected static Set getServiceAttributeNames(SSOToken token, String serviceName, SchemaType type) throws SMSException, SSOException {
ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, token);
ServiceSchema ss = null;
try {
ss = ssm.getSchema(type);
} catch (SMSException sme) {
if (debug.warningEnabled()) {
debug.warning("AMServiceUtils.getServiceAttributeNames():" + " No schema defined for " + type);
}
}
if ((ss == null) || (type == SchemaType.POLICY)) {
return Collections.EMPTY_SET;
}
return ss.getAttributeSchemaNames();
}
Aggregations