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 (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; }
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); } }
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); } }
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 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); }
private UserRealm getUserRealm(String tenantDomain) throws FrameworkException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain(UserFunctionsServiceHolder.getInstance() .getRegistryService(), UserFunctionsServiceHolder.getInstance().getRealmService(), tenantDomain); } catch (CarbonException e) { throw new FrameworkException( "Error occurred while retrieving the Realm for " + tenantDomain + " to retrieve user roles", e); } return realm; }
private UserRealm getUserRealm(String tenantDomain) throws FrameworkException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain(UserFunctionsServiceHolder.getInstance() .getRegistryService(), UserFunctionsServiceHolder.getInstance().getRealmService(), tenantDomain); } catch (CarbonException e) { throw new FrameworkException( "Error occurred while retrieving the Realm for " + tenantDomain + " to retrieve user roles", e); } return realm; }
/** * Get userRealm for the given tenantDomain * * @param tenantDomain Tenant domain relevant to the required userRealm * @return UserRealm as an object * @throws FrameworkException Error occurred during userRealm retrieving */ public static UserRealm getUserRealm(String tenantDomain) throws FrameworkException { UserRealm realm; try { realm = AnonymousSessionUtil.getRealmByTenantDomain(UserFunctionsServiceHolder.getInstance() .getRegistryService(), UserFunctionsServiceHolder.getInstance().getRealmService(), tenantDomain); } catch (CarbonException e) { throw new FrameworkException( "Error occurred while retrieving the Realm for " + tenantDomain + " to retrieve user roles", e); } return realm; }
public ClaimMapping[] getAllClaimMappings(String tenantDomain) throws ClaimManagementException { ClaimManager claimManager; try { UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain( ClaimManagementServiceComponent.getRegistryService(), ClaimManagementServiceComponent.getRealmService(), tenantDomain); claimManager = realm.getClaimManager(); if (claimManager == null) { // There can be cases - we get a request for an external user store - where we don' // have a claims administrator. return new ClaimMapping[0]; } return claimManager.getAllClaimMappings(); } catch (org.wso2.carbon.user.api.UserStoreException | CarbonException e) { throw new ClaimManagementException("Error occurred while loading claims mapping for tenant " + tenantDomain, e); } }
public ClaimMapping[] getAllClaimMappings(String tenantDomain) throws ClaimManagementException { ClaimManager claimManager; try { UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain( ClaimManagementServiceComponent.getRegistryService(), ClaimManagementServiceComponent.getRealmService(), tenantDomain); claimManager = realm.getClaimManager(); if (claimManager == null) { // There can be cases - we get a request for an external user store - where we don' // have a claims administrator. return new ClaimMapping[0]; } return claimManager.getAllClaimMappings(); } catch (org.wso2.carbon.user.api.UserStoreException | CarbonException e) { throw new ClaimManagementException("Error occurred while loading claims mapping for tenant " + tenantDomain, e); } }
public ClaimMapping[] getAllClaimMappings(String dialectURI, String tenantDomain) throws ClaimManagementException { ClaimManager claimManager; try { UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain( ClaimManagementServiceComponent.getRegistryService(), ClaimManagementServiceComponent.getRealmService(), tenantDomain); claimManager = realm.getClaimManager(); if (claimManager == null) { // There can be cases - we get a request for an external user store - where we don' // have a claims administrator. return new ClaimMapping[0]; } return claimManager.getAllClaimMappings(dialectURI); } catch (CarbonException | org.wso2.carbon.user.api.UserStoreException e) { throw new ClaimManagementException("Error occurred while loading all claim mappings for tenant " + tenantDomain, e); } }