String user = getUserNameFromOpenID(openID.getOpenID());
String domainName = null;
if (user != null) {
domainName = TenantUtils.getDomainNameFromOpenId(openID.getOpenID());
}
UserRealm userRealm = IdentityTenantUtil.getRealm(domainName, user);
Registry registry = IdentityTenantUtil.getRegistry(domainName, user);
RealmService realmService = IdentityRPServiceComponent.getRealmService();
if (user != null && userRealm.getUserStoreManager().isExistingUser(user)) {
this.onUserLogin(user, domainName, httpSess);
dto.setAuthenticated(true);
dto.setUserID(user);
CarbonAuthenticationUtil.onSuccessAdminLogin(httpSess, user,
realmService.getTenantManager().
getTenantId(domainName),
domainName, "Info card login");
} else {
// external parties
IdentityPersistenceManager persistentManager =
IdentityPersistenceManager.
getPersistanceManager();
if (persistentManager.hasSignedUpForOpenId(registry, userRealm, openID.getOpenID())) {
user = persistentManager.getUserIdForOpenIDSignUp(registry, userRealm,
openID.getOpenID());
if (userRealm.getUserStoreManager().isExistingUser(user)) {
CarbonAuthenticationUtil.onSuccessAdminLogin(httpSess,
user,
realmService.getTenantManager().getTenantId(domainName),
domainName,
"Info card login");