Search in sources :

Example 11 with AttributeSchema

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;
}
Also used : Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) HashSet(java.util.HashSet)

Example 12 with AttributeSchema

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;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) OrderedSet(com.sun.identity.shared.datastruct.OrderedSet) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) AttrSet(com.iplanet.services.ldap.AttrSet) SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) HashSet(java.util.HashSet)

Example 13 with AttributeSchema

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;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) HashSet(java.util.HashSet)

Example 14 with AttributeSchema

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)));
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) IOutput(com.sun.identity.cli.IOutput) AttributeSchema(com.sun.identity.sm.AttributeSchema)

Example 15 with AttributeSchema

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);
    }
}
Also used : SMSException(com.sun.identity.sm.SMSException) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) SSOException(com.iplanet.sso.SSOException) AMConsoleException(com.sun.identity.console.base.model.AMConsoleException) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

AttributeSchema (com.sun.identity.sm.AttributeSchema)149 Iterator (java.util.Iterator)80 ServiceSchema (com.sun.identity.sm.ServiceSchema)76 Set (java.util.Set)75 SMSException (com.sun.identity.sm.SMSException)67 HashSet (java.util.HashSet)59 SSOException (com.iplanet.sso.SSOException)58 ServiceSchemaManager (com.sun.identity.sm.ServiceSchemaManager)46 HashMap (java.util.HashMap)36 Map (java.util.Map)34 CLIException (com.sun.identity.cli.CLIException)28 CLIRequest (com.sun.identity.cli.CLIRequest)18 AfterTest (org.testng.annotations.AfterTest)18 BeforeTest (org.testng.annotations.BeforeTest)18 Parameters (org.testng.annotations.Parameters)18 Test (org.testng.annotations.Test)18 IOutput (com.sun.identity.cli.IOutput)14 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)10 CaseInsensitiveHashMap (com.sun.identity.common.CaseInsensitiveHashMap)9 SSOToken (com.iplanet.sso.SSOToken)8