use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class SelectRealmModelImpl method getAuthenticationInstances.
/**
* Returns set of authentication instances.
*
* @param realmName Name of Realm.
* @return set of authentication instances.
* @throws AMConsoleException if authentication instances cannot be
* obtained.
*/
public Set getAuthenticationInstances(String realmName) throws AMConsoleException {
Set names = Collections.EMPTY_SET;
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), realmName);
Set instances = mgr.getAuthenticationInstances();
if ((instances != null) && !instances.isEmpty()) {
names = new HashSet(instances.size());
for (Iterator i = instances.iterator(); i.hasNext(); ) {
names.add(((AMAuthenticationInstance) i.next()).getName());
}
}
} catch (AMConfigurationException e) {
throw new AMConsoleException(getErrorString(e));
}
return names;
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class PolicyModelImpl method getAuthenticationInstances.
/**
* Returns set of authentication instances.
*
* @param realmName Name of Realm.
* @return set of authentication instances.
* @throws AMConsoleException if authentication instances cannot be
* obtained.
*/
public Set getAuthenticationInstances(String realmName) throws AMConsoleException {
Set names = Collections.EMPTY_SET;
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), realmName);
Set instances = mgr.getAuthenticationInstances();
if ((instances != null) && !instances.isEmpty()) {
names = new HashSet(instances.size());
for (Iterator i = instances.iterator(); i.hasNext(); ) {
names.add(((AMAuthenticationInstance) i.next()).getName());
}
}
} catch (AMConfigurationException e) {
throw new AMConsoleException(getErrorString(e));
}
return names;
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method hasAuthAttributes.
/**
* Returns true if there are attributes for a authentication type.
*
* @param type Authtentication type.
* @return true if there are attributes for a authentication type.
*/
public boolean hasAuthAttributes(String type) {
boolean has = false;
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
AMAuthenticationSchema schema = mgr.getAuthenticationSchema(type);
has = !schema.getAttributeSchemas().isEmpty();
} catch (AMConfigurationException e) {
debug.warning("AuthPropertiesModelImpl.hasAuthAttributes", e);
}
return has;
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method getServiceName.
/**
* To get the service name from the instance name:
* 1) get a handle to the AMAuthenicationInstance object
* 2) from the AuthInstance object get the type of instance
* 3) Use the instance type to get the schema for that type
* 4) from the schema get the service name
*/
public String getServiceName(String instance) {
String name = null;
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
AMAuthenticationInstance inst = mgr.getAuthenticationInstance(instance);
if (inst != null) {
AMAuthenticationSchema schema = mgr.getAuthenticationSchema(inst.getType());
name = schema.getServiceName();
} else {
if (debug.warningEnabled()) {
debug.warning("AuthPropertiesModel.getServiceName, " + " the requested instance " + instance + " does not exist.");
}
}
} catch (AMConfigurationException ace) {
if (debug.warningEnabled()) {
debug.warning("problem getting service name for " + instance, ace);
}
}
return name;
}
use of com.sun.identity.authentication.config.AMConfigurationException in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method getInstanceValues.
public Map getInstanceValues(String name) {
Map values = null;
String[] params = { currentRealm, name };
logEvent("ATTEMPT_GET_AUTH_INSTANCE_PROFILE", params);
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
AMAuthenticationInstance ai = mgr.getAuthenticationInstance(name);
values = ai.getAttributeValues();
logEvent("SUCCEED_GET_AUTH_INSTANCE_PROFILE", params);
} catch (AMConfigurationException e) {
String[] paramsEx = { currentRealm, name, getErrorString(e) };
logEvent("AUTH_CONFIGURATION_EXCEPTION_GET_AUTH_INSTANCE_PROFILE", paramsEx);
debug.warning("AuthPropertiesModelImpl.getInstanceValues", e);
}
return (values == null) ? Collections.EMPTY_MAP : values;
}
Aggregations