protected void updateUserProfileWithAttribute(final UserProfile userProfile, final Principal principal,
                                                  final String attributeName, final Consumer<String> profileUpdater) {
        val mappedAttributeName = properties.getAttributeMappings().getOrDefault(attributeName, attributeName);
        if (principal.getAttributes().containsKey(mappedAttributeName)) {
            val values = principal.getAttributes().get(mappedAttributeName);
            LOGGER.trace("Setting Okta user profile attribute [{}] to [{}]", mappedAttributeName, values);
            CollectionUtils.firstElement(values).ifPresent(value -> profileUpdater.accept(value.toString()));
        }
    }
This is {@link OktaPrincipalProvisioner}.

@author Misagh Moayyed
@since 7.0.0
support/cas-server-support-okta-authentication/src/main/java/org/apereo/cas/okta/OktaPrincipalProvisioner.java