private void validateRequiredParametersInService(ReceiptServiceInput receiptServiceInput) throws ConsentManagementException { if (isBlank(receiptServiceInput.getService())) { throw handleClientException(ERROR_CODE_SERVICE_NAME_REQUIRED, null); } if (isEmpty(receiptServiceInput.getPurposes())) { throw handleClientException(ERROR_CODE_AT_LEAST_ONE_PURPOSE_REQUIRED, null); } // Set authenticated user's tenant id if it is not set. if (isBlank(receiptServiceInput.getTenantDomain())) { receiptServiceInput.setTenantId(getTenantIdFromCarbonContext()); receiptServiceInput.setTenantDomain(getTenantDomainFromCarbonContext()); } else { receiptServiceInput.setTenantId(getTenantId(realmService, receiptServiceInput.getTenantDomain())); } }
private void setIDPData(String tenantDomain, ReceiptServiceInput receiptServiceInput) throws IdentityProviderManagementException { IdentityProviderManager idpManager = IdentityProviderManager.getInstance(); IdentityProvider residentIdP = idpManager.getResidentIdP(tenantDomain); if (StringUtils.isEmpty(receiptServiceInput.getService())) { if (log.isDebugEnabled()) { log.debug("No service name found. Hence adding resident IDP home realm ID"); } receiptServiceInput.setService(residentIdP.getHomeRealmId()); } if (StringUtils.isEmpty(receiptServiceInput.getTenantDomain())) { receiptServiceInput.setTenantDomain(tenantDomain); } if (StringUtils.isEmpty(receiptServiceInput.getSpDescription())) { if (StringUtils.isNotEmpty(residentIdP.getIdentityProviderDescription())) { receiptServiceInput.setSpDescription(residentIdP.getIdentityProviderDescription()); } else { receiptServiceInput.setSpDescription(IdentityRecoveryConstants.Consent.RESIDENT_IDP); } } if (StringUtils.isEmpty(receiptServiceInput.getSpDisplayName())) { if (StringUtils.isNotEmpty(residentIdP.getDisplayName())) { receiptServiceInput.setSpDisplayName(residentIdP.getDisplayName()); } else { receiptServiceInput.setSpDisplayName(IdentityRecoveryConstants.Consent.RESIDENT_IDP); } } }
if (StringUtils.isEmpty(receiptServiceInput.getTenantDomain())) { receiptServiceInput.setTenantDomain(tenantDomain);
if (StringUtils.isEmpty(receiptServiceInput.getTenantDomain())) { receiptServiceInput.setTenantDomain(tenantDomain);