use of com.sun.identity.authentication.config.AMAuthenticationSchema in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method createAuthInstance.
public void createAuthInstance(String name, String type) throws AMConsoleException {
String[] params = { currentRealm, name, type };
logEvent("ATTEMPT_CREATE_AUTH_INSTANCE", params);
try {
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), currentRealm);
AMAuthenticationSchema as = mgr.getAuthenticationSchema(type);
mgr.createAuthenticationInstance(name, type, as.getAttributeValues());
logEvent("SUCCEED_CREATE_AUTH_INSTANCE", params);
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramsEx = { currentRealm, name, type, strError };
logEvent("AUTH_CONFIG_EXCEPTION_CREATE_AUTH_INSTANCE", paramsEx);
debug.warning("AuthPropertiesModelImpl.createAuthInstance ", e);
throw new AMConsoleException(strError);
}
}
use of com.sun.identity.authentication.config.AMAuthenticationSchema in project OpenAM by OpenRock.
the class AuthPropertiesModelImpl method getAuthTypes.
public Map getAuthTypes() {
Map authAndLocalizedTypes = Collections.EMPTY_MAP;
try {
logEvent("ATTEMPT_GET_AUTH_TYPE", getServerInstanceForLogMsg());
AMAuthenticationManager mgr = new AMAuthenticationManager(getUserSSOToken(), "/");
Set types = mgr.getAuthenticationTypes();
authAndLocalizedTypes = new HashMap(types.size());
for (Iterator iter = types.iterator(); iter.hasNext(); ) {
String authType = (String) iter.next();
AMAuthenticationSchema schema = mgr.getAuthenticationSchema(authType);
String svcName = schema.getServiceName();
String localizedName = (svcName != null && svcName.length() > 0) ? getLocalizedServiceName(svcName) : authType;
authAndLocalizedTypes.put(authType, localizedName);
}
logEvent("SUCCEED_GET_AUTH_TYPE", getServerInstanceForLogMsg());
} catch (AMConfigurationException e) {
String strError = getErrorString(e);
String[] paramEx = { strError };
logEvent("SMS_EXCEPTION_GET_AUTH_TYPE", paramEx);
debug.warning("AuthPropertiesModelImpl.getAuthTypes", e);
}
return authAndLocalizedTypes;
}
Aggregations