protected Profile createProfileWithSsoInfo(String username, Tenant tenant, HttpServletRequest request) throws ProfileException { Map<String, Object> attributes = null; List<AttributeDefinition> attributeDefinitions = tenant.getAttributeDefinitions(); String email = request.getHeader(emailHeaderName); for (AttributeDefinition attributeDefinition : attributeDefinitions) { String attributeName = attributeDefinition.getName(); String attributeValue = request.getHeader(mellonHeaderPrefix + attributeName); if (StringUtils.isNotEmpty(attributeValue)) { if (attributes == null) { attributes = new HashMap<>(); } attributes.put(attributeName, attributeValue); } } logger.info("Creating new profile with SSO info: username={}, email={}, tenant={}, attributes={}", username, email, tenant.getName(), attributes); return profileService.createProfile(tenant.getName(), username, null, email, true, null, attributes, null); }