use of org.ovirt.engine.api.extensions.aaa.Authn 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.api.extensions.aaa.Authn 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();
}
use of org.ovirt.engine.api.extensions.aaa.Authn in project ovirt-engine by oVirt.
the class TokenCleanupUtility method invokeAuthnLogout.
private static void invokeAuthnLogout(SsoContext ssoContext, SsoSession ssoSession) throws Exception {
String profileName = ssoSession.getProfile();
String principalName = ssoSession.getUserId();
ExtMap authRecord = null;
ExtensionProxy authn = null;
try {
authRecord = ssoSession.getAuthRecord();
if (StringUtils.isNotEmpty(profileName) && StringUtils.isNotEmpty(principalName)) {
for (ExtensionProxy authnExtension : ssoContext.getSsoExtensionsManager().getExtensionsByService(Authn.class.getName())) {
Properties config = authnExtension.getContext().get(Base.ContextKeys.CONFIGURATION);
if (profileName.equals(config.getProperty(Authn.ConfigKeys.PROFILE_NAME))) {
authn = authnExtension;
break;
}
}
}
} catch (Exception ex) {
throw new RuntimeException(String.format("Unable to invalidate sessions for token: %s", ex.getMessage()));
} finally {
if (authn != null && authRecord != null && (authn.getContext().<Long>get(Authn.ContextKeys.CAPABILITIES) & Authn.Capabilities.LOGOUT) != 0) {
authn.invoke(new ExtMap().mput(Base.InvokeKeys.COMMAND, Authn.InvokeCommands.LOGOUT).mput(Authn.InvokeKeys.AUTH_RECORD, authRecord));
}
}
}
Aggregations