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;
}
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;
}
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;
}
Aggregations