use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class GenericAgentProfileViewBean method getPropertyNames.
protected HashSet getPropertyNames() {
String agentType = getAgentType();
HashSet names = new HashSet();
for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
AttributeSchema as = (AttributeSchema) i.next();
names.add(as.getName());
}
if (isLocalConfig(agentType)) {
names.remove(AgentsViewBean.DESCRIPTION);
}
return names;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class DirectoryServicesImpl method getServiceAttributesWithQualifier.
/**
* Method to get the attribute names of a service with CosQualifier. For
* example: Return set could be ["iplanet-am-web-agent-allow-list
* merge-schemes", "iplanet-am-web-agent-deny-list merge-schemes"] This only
* returns Dynamic attributes
*/
private Set getServiceAttributesWithQualifier(SSOToken token, String serviceName) throws SMSException, SSOException {
ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, token);
ServiceSchema ss = null;
try {
ss = ssm.getSchema(SchemaType.DYNAMIC);
} catch (SMSException sme) {
if (debug.warningEnabled()) {
debug.warning("DirectoryServicesImpl.getServiceNames(): No " + "schema defined for SchemaType.DYNAMIC type");
}
}
if (ss == null) {
return Collections.EMPTY_SET;
}
Set attrNames = new HashSet();
Set attrSchemaNames = ss.getAttributeSchemaNames();
Iterator itr = attrSchemaNames.iterator();
while (itr.hasNext()) {
String attrSchemaName = (String) itr.next();
AttributeSchema attrSchema = ss.getAttributeSchema(attrSchemaName);
String name = attrSchemaName + " " + attrSchema.getCosQualifier();
attrNames.add(name);
}
return attrNames;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class AMAuthenticationSchema method getRequiredAttributeNames.
/**
* Returns a set of required attribute names.
*
* @return a <code>Set</code> of the required attribute names of
* the subject schema.
*/
public Set getRequiredAttributeNames() {
Set names = new HashSet();
for (Iterator it = getAttributeNames().iterator(); it.hasNext(); ) {
String attr = (String) it.next();
AttributeSchema as = getAttributeSchema(attr);
String anyValue = as.getAny();
if (anyValue != null && (anyValue.indexOf("required") != -1)) {
names.add(attr);
}
}
return names;
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class GetAttributeSchemaChoiceValues method handleRequest.
@Override
public void handleRequest(RequestContext rc) throws CLIException {
super.handleRequest(rc);
ldapLogin();
String schemaType = getStringOptionValue(IArgument.SCHEMA_TYPE);
String serviceName = getStringOptionValue(IArgument.SERVICE_NAME);
String subSchemaName = getStringOptionValue(IArgument.SUBSCHEMA_NAME);
String attributeName = getStringOptionValue(IArgument.ATTRIBUTE_NAME);
ServiceSchema ss = getServiceSchema();
IOutput outputWriter = getOutputWriter();
String[] params = { serviceName, schemaType, subSchemaName, attributeName };
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "ATTEMPT_GET_ATTRIBUTE_SCHEMA_CHOICE_VALUES", params);
AttributeSchema attrSchema = ss.getAttributeSchema(attributeName);
if (attrSchema == null) {
String[] args = { serviceName, schemaType, subSchemaName, attributeName, "attribute schema does not exist" };
attributeSchemaNoExist(attributeName, "FAILED_GET_ATTRIBUTE_SCHEMA_CHOICE_VALUES", args);
}
writeLog(LogWriter.LOG_ACCESS, Level.INFO, "SUCCEED_GET_ATTRIBUTE_SCHEMA_CHOICE_VALUES", params);
getOutputWriter().printlnMessage(FormatUtils.formatMap(getResourceString("attribute-schema-i18nkey"), getResourceString("attribute-schema-choice-value"), getChoiceValues(attrSchema)));
}
use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.
the class FSSAMLServiceModelImpl method setAttributeValues.
/**
* Set SAMLv1.x attribute values.
*
* @param values Attribute values. Map of attribute name to set of values.
* @throws AMConsoleException if values cannot be set.
*/
public void setAttributeValues(Map values) throws AMConsoleException {
String[] params = new String[3];
params[0] = SAML_SERVICE_NAME;
params[1] = "-";
String curAttrSchemaName = "";
try {
for (Iterator iter = values.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
String name = (String) entry.getKey();
curAttrSchemaName = name;
params[2] = name;
logEvent("ATTEMPT_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
AttributeSchema as = (AttributeSchema) attributeSchemas.get(name);
as.setDefaultValues((Set) entry.getValue());
logEvent("SUCCEED_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", params);
}
} catch (SSOException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", curAttrSchemaName, strError };
logEvent("SSO_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
} catch (SMSException e) {
String strError = getErrorString(e);
String[] paramsEx = { SAML_SERVICE_NAME, "-", curAttrSchemaName, strError };
logEvent("SMS_EXCEPTION_SET_ATTR_VALUE_ATR_SCHEMA_SCHEMA_TYPE", paramsEx);
throw new AMConsoleException(strError);
}
}
Aggregations