use of org.ovirt.engine.core.extensions.mgr.ExtensionProxy in project ovirt-engine by oVirt.
the class SsoContext method createProfiles.
private void createProfiles() {
// Get the extensions that correspond to authn (authentication) service.
// For each extension - get the relevant authn extension.
Map<String, AuthenticationProfile> results = new HashMap<>();
for (ExtensionProxy authnExtension : ssoExtensionsManager.getExtensionsByService(Authn.class.getName())) {
try {
String mapperName = authnExtension.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION).getProperty(Authn.ConfigKeys.MAPPING_PLUGIN);
String authzName = authnExtension.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION).getProperty(Authn.ConfigKeys.AUTHZ_PLUGIN);
AuthenticationProfile profile = new AuthenticationProfile(authnExtension, ssoExtensionsManager.getExtensionByName(authzName), mapperName != null ? ssoExtensionsManager.getExtensionByName(mapperName) : null);
if (results.containsKey(profile.getName())) {
log.warn("Profile name '{}' already registered for '{}', ignoring for '{}'", profile.getName(), results.get(profile.getName()).getAuthnName(), profile.getAuthnName());
} else {
results.put(profile.getName(), profile);
}
} catch (ConfigurationException e) {
log.debug("Exception", e);
}
}
profiles = results;
}
use of org.ovirt.engine.core.extensions.mgr.ExtensionProxy in project ovirt-engine by oVirt.
the class AuthenticationUtils method getProfileEntry.
private static Map<String, Object> getProfileEntry(SsoExtensionsManager extensionsManager, ExtensionProxy authn) {
Map<String, Object> profileEntry = new HashMap<>();
profileEntry.put("authn_name", getProfileName(authn));
ExtensionProxy authz = extensionsManager.getExtensionByName(getAuthzName(authn));
profileEntry.put("authz_name", AuthzUtils.getName(authz));
profileEntry.put("capability_password_auth", AuthzUtils.supportsPasswordAuthentication(authz));
return profileEntry;
}
use of org.ovirt.engine.core.extensions.mgr.ExtensionProxy in project ovirt-engine by oVirt.
the class AAAServiceImpl method acctReport.
private void acctReport(int reason, String authzName, ExtMap authRecord, ExtMap principalRecord, String user, String msg) {
String displayUser = null;
if (displayUser == null && principalRecord != null) {
displayUser = principalRecord.get(Authz.PrincipalRecord.NAME);
}
if (displayUser == null && authRecord != null) {
displayUser = authRecord.get(Authn.AuthRecord.PRINCIPAL);
}
if (displayUser == null) {
displayUser = user;
}
String displayMessage = String.format(msg, displayUser);
List<ExtensionProxy> acctExtensions = getExtensionsManager().getExtensionsByService(Acct.class.getName());
if (acctExtensions != null) {
ExtMap input = new ExtMap().mput(Acct.InvokeKeys.REASON, reason).mput(Base.InvokeKeys.COMMAND, Acct.InvokeCommands.REPORT).mput(Acct.InvokeKeys.PRINCIPAL_RECORD, new ExtMap().mput(Acct.PrincipalRecord.AUTHZ_NAME, authzName).mput(Acct.PrincipalRecord.AUTH_RECORD, authRecord).mput(Acct.PrincipalRecord.PRINCIPAL_RECORD, principalRecord).mput(Acct.PrincipalRecord.USER, displayUser).mput(Acct.InvokeKeys.MESSAGE, String.format(displayMessage, displayUser)));
for (ExtensionProxy proxy : acctExtensions) {
log.info("API: -->Acct.InvokeCommands.REPORT extension={}, reason={}, user='{}', message='{}'", proxy.getContext().get(Base.ContextKeys.INSTANCE_NAME), getFieldNameByValue(Acct.ReportReason.class, reason), displayUser, displayMessage);
proxy.invoke(input);
log.info("API: <--Acct.InvokeCommands.REPORT");
}
}
}
use of org.ovirt.engine.core.extensions.mgr.ExtensionProxy in project ovirt-engine by oVirt.
the class AcctUtils method report.
public static void report(ExtMap input) {
List<ExtensionProxy> acctExtensions = EngineExtensionsManager.getInstance().getExtensionsByService(Acct.class.getName());
input.putIfAbsent(Base.InvokeKeys.COMMAND, Acct.InvokeCommands.REPORT);
if (acctExtensions != null) {
for (ExtensionProxy proxy : acctExtensions) {
proxy.invoke(input);
}
}
}
use of org.ovirt.engine.core.extensions.mgr.ExtensionProxy in project ovirt-engine by oVirt.
the class AuthenticationProfileRepository method createProfiles.
private void createProfiles() {
// Get the extensions that correspond to authn (authentication) service.
// For each extension - get the relevant authn extension.
Map<String, AuthenticationProfile> results = new HashMap<>();
for (ExtensionProxy authnExtension : EngineExtensionsManager.getInstance().getExtensionsByService(Authn.class.getName())) {
try {
String mapperName = authnExtension.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION).getProperty(Authn.ConfigKeys.MAPPING_PLUGIN);
String authzName = authnExtension.getContext().<Properties>get(Base.ContextKeys.CONFIGURATION).getProperty(Authn.ConfigKeys.AUTHZ_PLUGIN);
AuthenticationProfile profile = new AuthenticationProfile(authnExtension, authzName, mapperName != null ? EngineExtensionsManager.getInstance().getExtensionByName(mapperName) : null);
if (results.containsKey(profile.getName())) {
log.warn("Profile name '{}' already registered for '{}', ignoring for '{}'", profile.getName(), results.get(profile.getName()).getAuthnName(), profile.getAuthnName());
} else {
results.put(profile.getName(), profile);
}
} catch (ConfigurationException e) {
log.debug("Ignoring", e);
}
}
profiles = results;
setChanged();
notifyObservers();
}
Aggregations