def METHOD_NAME(user_obj,
                     password,
                     options=None,
                     superuser_realms=None,
                     check_otp=False):
    """
    This function is used to authenticate the user at the web ui.
    It checks against the userstore or against OTP/privacyidea (check_otp).
    It returns a tuple of
    * true/false if the user authenticated successfully
    * the role of the user
    * the "detail" dictionary of the response
    :param user_obj: The user who tries to authenticate
    :type user_obj: User Object
    :param password: Password, static and or OTP
    :param options: additional options like g and clientip
    :type options: dict
    :param superuser_realms: list of realms, that contain admins
    :type superuser_realms: list
    :param check_otp: If set, the user is not authenticated against the
         userstore but against privacyidea
    :return: tuple of bool, string and dict/None
    """
    options = options or {}
    superuser_realms = superuser_realms or []
    user_auth = False
    role = ROLE.USER
    details = None
    if check_otp:
        # check if the given password matches an OTP token
        try:
            check, details = check_user_pass(user_obj, password, options=options)
            details["loginmode"] = "privacyIDEA"
            if check:
                user_auth = True
        except Exception as e:
            log.debug("Error authenticating user against privacyIDEA: {0!r}".format(e))
    else:
        # check the password of the user against the userstore
        if user_obj.check_password(password):
            user_auth = True
    # If the realm is in the SUPERUSER_REALM then the authorization role
    # is risen to "admin".
    if user_obj.realm in superuser_realms:
        role = ROLE.ADMIN
    return user_auth, role, details