protected UserRealm getUserRealm(String tenantDomain) throws UserExportException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); } catch (CarbonException e) { throw new UserExportException( "Error occurred while retrieving the Realm for " + tenantDomain + " to handle claims", e); } return realm; }
private static UserRealm getRealmForAnonymousSession(String domainName, String username) throws IdentityException { try { if (username != null) { return AnonymousSessionUtil.getRealmByUserName(registryService, realmService, username); } if (domainName == null) { domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, domainName); } catch (CarbonException e) { throw IdentityException.error("Error Obtaining a realm for user name: " + username + " and " + "domain:" + domainName, e); } }
@SuppressWarnings("deprecation") private static Registry getRegistryForAnonymousSession(String domainName, String username) throws IdentityException { try { if (domainName == null && username == null) { domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } if (username == null) { return AnonymousSessionUtil.getSystemRegistryByDomainName(registryService, realmService, domainName); } else { return AnonymousSessionUtil.getSystemRegistryByUserName(registryService, realmService, username); } } catch (CarbonException e) { log.error("Error obtaining a registry instance", e); throw IdentityException.error("Error obtaining a registry instance", e); } }
public static Map<String, String> getUserClaimValues(String username, String[] requestedClaims, String profile) throws IdentityException { try { UserRealm userRealm = AnonymousSessionUtil.getRealmByUserName(SAMLSSOUtil.getRegistryService(), SAMLSSOUtil.getRealmService(), username); if(userRealm == null){ throw IdentityException.error("User realm is not present for this user name:" + username); } username = MultitenantUtils.getTenantAwareUsername(username); UserStoreManager userStoreManager = userRealm.getUserStoreManager(); return userStoreManager.getUserClaimValues(username, requestedClaims, profile); } catch (UserStoreException e) { log.error("Error while retrieving claims values", e); throw IdentityException.error( "Error while retrieving claims values", e); } catch (CarbonException e) { log.error("Error while retrieving claims values", e); throw IdentityException.error( "Error while retrieving claim values", e); } }
public static Map<String, String> getUserClaimValues(String username, String[] requestedClaims, String profile) throws IdentityException { try { UserRealm userRealm = AnonymousSessionUtil.getRealmByUserName(SAMLSSOUtil.getRegistryService(), SAMLSSOUtil.getRealmService(), username); if(userRealm == null){ throw IdentityException.error("User realm is not present for this user name:" + username); } username = MultitenantUtils.getTenantAwareUsername(username); UserStoreManager userStoreManager = userRealm.getUserStoreManager(); return userStoreManager.getUserClaimValues(username, requestedClaims, profile); } catch (UserStoreException e) { log.error("Error while retrieving claims values", e); throw IdentityException.error( "Error while retrieving claims values", e); } catch (CarbonException e) { log.error("Error while retrieving claims values", e); throw IdentityException.error( "Error while retrieving claim values", e); } }
private UserRealm getUserRealm(String tenantDomain) throws FrameworkException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain( FrameworkServiceComponent.getRegistryService(), FrameworkServiceComponent.getRealmService(), tenantDomain); } catch (CarbonException e) { throw new FrameworkException("Error occurred while retrieving the Realm for " + tenantDomain + " to handle local claims", e); } return realm; }
private static UserRealm getRealmForAnonymousSession(String domainName, String username) throws IdentityException { try { if (username != null) { return AnonymousSessionUtil.getRealmByUserName(registryService, realmService, username); } if (domainName == null) { domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, domainName); } catch (CarbonException e) { throw IdentityException.error("Error Obtaining a realm for user name: " + username + " and " + "domain:" + domainName, e); } }
List<String> mappedClaims = new ArrayList<String>(); UserRealm userRealm = AnonymousSessionUtil.getRealmByUserName(CASSSOUtil.getRegistryService(), CASSSOUtil.getRealmService(), username);
@SuppressWarnings("deprecation") private static Registry getRegistryForAnonymousSession(String domainName, String username) throws IdentityException { try { if (domainName == null && username == null) { domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } if (username == null) { return AnonymousSessionUtil.getSystemRegistryByDomainName(registryService, realmService, domainName); } else { return AnonymousSessionUtil.getSystemRegistryByUserName(registryService, realmService, username); } } catch (CarbonException e) { log.error("Error obtaining a registry instance", e); throw IdentityException.error("Error obtaining a registry instance", e); } }
private UserRealm getUserRealm(String tenantDomain) throws PostAuthenticationFailedException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain( FrameworkServiceComponent.getRegistryService(), FrameworkServiceComponent.getRealmService(), tenantDomain); } catch (CarbonException e) { throw new PostAuthenticationFailedException("Error while handling missing mandatory claims", "Error occurred while retrieving the Realm for " + tenantDomain + " to handle local claims", e); } return realm; }
private static UserRealm getRealmForAnonymousSession(String domainName, String username) throws IdentityException { try { if (domainName == null && username == null) { domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } if (username == null) { return AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, domainName); } else if (username != null) { return AnonymousSessionUtil.getRealmByUserName(registryService, realmService, username); } } catch (CarbonException e) { log.error("Error obtaining the realm", e); throw IdentityException.error("Error Obtaining a realm", e); } return null; }
@SuppressWarnings("deprecation") private static Registry getRegistryForAnonymousSession(String domainName, String username) throws IdentityException { try { if (domainName == null && username == null) { domainName = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; } if (username == null) { return AnonymousSessionUtil.getSystemRegistryByDomainName(registryService, realmService, domainName); } else { return AnonymousSessionUtil.getSystemRegistryByUserName(registryService, realmService, username); } } catch (CarbonException e) { log.error("Error obtaining a registry instance", e); throw IdentityException.error("Error obtaining a registry instance", e); } }
private UserRealm getUserRealm(String tenantDomain) throws FrameworkException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain( FrameworkServiceComponent.getRegistryService(), FrameworkServiceComponent.getRealmService(), tenantDomain); } catch (CarbonException e) { throw new FrameworkException("Error occurred while retrieving the Realm for " + tenantDomain + " to handle local claims", e); } return realm; }
private UserRealm getUserRealm(String tenantDomain) throws PostAuthenticationFailedException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain( FrameworkServiceComponent.getRegistryService(), FrameworkServiceComponent.getRealmService(), tenantDomain); } catch (CarbonException e) { throw new PostAuthenticationFailedException("Error while handling missing mandatory claims", "Error occurred while retrieving the Realm for " + tenantDomain + " to handle local claims", e); } return realm; }
private UserRealm getUserRealm(String tenantDomain) throws FrameworkException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain( FrameworkServiceComponent.getRegistryService(), FrameworkServiceComponent.getRealmService(), tenantDomain); } catch (CarbonException e) { throw new FrameworkException("Error occurred while retrieving the Realm for " + tenantDomain + " to handle local claims", e); } return realm; }
private boolean authenticate(String username, String password, RealmService realmService) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); RegistryService registryService = (RegistryService) carbonContext.getOSGiService(RegistryService.class, null); String tenantDomain = MultitenantUtils.getTenantDomain(username); try { UserRealm userRealm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); if (userRealm == null) { log.error(String.format("Can't get the user realm for the tenant domain %s. Invalid domain or unactivated tenant login.", tenantDomain)); return false; } String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(username); return userRealm.getUserStoreManager().authenticate(tenantAwareUsername, password); } catch (CarbonException e) { log.error(String.format("Can't get the user realm for the tenant domain %s.", tenantDomain), e); return false; } catch (UserStoreException e) { log.error("Error while authenticating the user against the user store manager", e); return false; } }
/** * @param userName * @param tenantDomain * @return * @throws CarbonException * @throws UserStoreException */ private List<String> getUserRoles(String userName, String tenantDomain) throws CarbonException, UserStoreException { RegistryService registryService = IdentityProvisionServiceComponent.getRegistryService(); RealmService realmService = IdentityProvisionServiceComponent.getRealmService(); UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); UserStoreManager userstore = null; userstore = realm.getUserStoreManager(); String[] newRoles = userstore.getRoleListOfUser(userName); return Arrays.asList(newRoles); }
/** * @param userName * @param tenantDomain * @return * @throws CarbonException * @throws UserStoreException */ private List<String> getUserRoles(String userName, String tenantDomain) throws CarbonException, UserStoreException { RegistryService registryService = IdentityProvisionServiceComponent.getRegistryService(); RealmService realmService = IdentityProvisionServiceComponent.getRealmService(); UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); UserStoreManager userstore = null; userstore = realm.getUserStoreManager(); String[] newRoles = userstore.getRoleListOfUser(userName); return Arrays.asList(newRoles); }
/** * @param userName * @param tenantDomain * @return * @throws CarbonException * @throws UserStoreException */ private List<String> getUserRoles(String userName, String tenantDomain) throws CarbonException, UserStoreException { RegistryService registryService = IdentityProvisionServiceComponent.getRegistryService(); RealmService realmService = IdentityProvisionServiceComponent.getRealmService(); UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain); UserStoreManager userstore = null; userstore = realm.getUserStoreManager(); String[] newRoles = userstore.getRoleListOfUser(userName); return Arrays.asList(newRoles); }
private UserRealm getUserRealm(String tenantDomain) throws CarbonException { return AnonymousSessionUtil.getRealmByTenantDomain(IdentityRecoveryServiceDataHolder.getInstance() .getRegistryService(), IdentityRecoveryServiceDataHolder.getInstance().getRealmService(), tenantDomain); }