code: def get_user_id(self, user):
          
          user_field = getattr(settings, 'SAML_IDP_DJANGO_USERNAME_FIELD', None) or \
                       getattr(user, 'USERNAME_FIELD', 'username')
          return str(getattr(user, user_field))
docs: Get identifier for a user. Take the one defined in settings.SAML_IDP_DJANGO_USERNAME_FIELD first, if not set
              use the USERNAME_FIELD property which is set on the user Model. This defaults to the user.username field.