code: def update_user_attributes(self, user, claims):
          
  
          required_fields = [field.name for field in user._meta.fields if field.blank is False]
  
          for field, claim in settings.CLAIM_MAPPING.items():
              if hasattr(user, field):
                  if claim in claims:
                      setattr(user, field, claims[claim])
                      logger.debug("Attribute '{}' for user '{}' was set to '{}'.".format(field, user, claims[claim]))
                  else:
                      if field in required_fields:
                          msg = "Claim not found in access token: '{}'. Check ADFS claims mapping."
                          raise ImproperlyConfigured(msg.format(claim))
                      else:
                          msg = "Claim '{}' for user field '{}' was not found in the access token for user '{}'. " \
                                "Field is not required and will be left empty".format(claim, field, user)
                          logger.warning(msg)
              else:
                  msg = "User model has no field named '{}'. Check ADFS claims mapping."
                  raise ImproperlyConfigured(msg.format(field))
docs: Updates user attributes based on the CLAIM_MAPPING setting.
  
          Args:
              user (django.contrib.auth.models.User): User model instance
              claims (dict): claims from the access token