Search in sources :

Example 76 with AttributeSchema

use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.

the class CLIUtil method getPasswordFields.

/**
     * Returns a set of attributes (of password syntax) of a given service.
     *
     * @param serviceName Name of service.
     * @return a set of attributes (of password syntax) of a given service.
     * @throws SMSException if error occurs when reading the service schema 
     *         layer
     * @throws SSOException if Single sign-on token is invalid.
     */
public static Set getPasswordFields(String serviceName) throws SMSException, SSOException {
    Set setPasswords = new HashSet();
    SSOToken ssoToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, ssoToken);
    if (ssm != null) {
        ServiceSchema schema = ssm.getOrganizationSchema();
        if (schema != null) {
            Set attributeSchemas = schema.getAttributeSchemas();
            for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
                AttributeSchema as = (AttributeSchema) i.next();
                if (as.getSyntax().equals(AttributeSchema.Syntax.PASSWORD)) {
                    setPasswords.add(as.getName());
                }
            }
        }
    }
    return setPasswords;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SSOToken(com.iplanet.sso.SSOToken) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) HashSet(java.util.HashSet)

Example 77 with AttributeSchema

use of com.sun.identity.sm.AttributeSchema in project OpenAM by OpenRock.

the class CLIUtil method getPasswordFields.

/**
     * Returns a set of attributes (of password syntax) of a given service.
     *
     * @param serviceName Name of service.
     * @param schemaType Type of Schema.
     * @param subSchema Name of SubSchema
     * @return a set of attributes (of password syntax) of a given service.
     * @throws SMSException if error occurs when reading the service schema 
     *         layer
     * @throws SSOException if Single sign-on token is invalid.
     */
public static Set getPasswordFields(String serviceName, SchemaType schemaType, String subSchema) throws SMSException, SSOException {
    Set setPasswords = new HashSet();
    SSOToken ssoToken = (SSOToken) AccessController.doPrivileged(AdminTokenAction.getInstance());
    ServiceSchemaManager ssm = new ServiceSchemaManager(serviceName, ssoToken);
    if (ssm != null) {
        ServiceSchema schema = ssm.getSchema(schemaType);
        if (schema != null) {
            ServiceSchema ss = schema.getSubSchema(subSchema);
            Set attributeSchemas = ss.getAttributeSchemas();
            for (Iterator i = attributeSchemas.iterator(); i.hasNext(); ) {
                AttributeSchema as = (AttributeSchema) i.next();
                if (as.getSyntax().equals(AttributeSchema.Syntax.PASSWORD)) {
                    setPasswords.add(as.getName());
                }
            }
        }
    }
    return setPasswords;
}
Also used : ServiceSchema(com.sun.identity.sm.ServiceSchema) Set(java.util.Set) HashSet(java.util.HashSet) SSOToken(com.iplanet.sso.SSOToken) Iterator(java.util.Iterator) AttributeSchema(com.sun.identity.sm.AttributeSchema) ServiceSchemaManager(com.sun.identity.sm.ServiceSchemaManager) HashSet(java.util.HashSet)

Example 78 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 79 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 80 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)

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