【问题标题】:Log out button for node-red-dashboard templatenode-red-dashboard 模板的注销按钮
【发布时间】:2018-02-27 02:57:50
【问题描述】:

我有一个 node-red-dashboard 应用程序,我想退出。我为 adminAuth、httpNodeAuth 和 https 密钥/证书设置了 settings.js。我正在使用模板并希望包含一个注销按钮。我试过了:

    scope.logOut = function() {
        $.ajax({
            type: "GET",
            url: '/ui',
            dataType: 'json',
            async: true,
            username: "logout",
            password: "logout",
            data: '{ "comment" }'
        })

        //In our case, we WANT to get access denied, so a success would be a failure.
        .done(function(){
            alert('Error!')
        })

        //Likewise, a failure *usually* means we succeeded.
        //set window.location to redirect the user to wherever you want them to go
        .fail(function(){
            window.location = "/ui";
        });
    }

这将重新提示输入用户名和密码,但如果我只是点击后退按钮,我会在没有登录的情况下返回应用程序。我将完全退出并跨浏览器生效。

【问题讨论】:

  • 不确定这是否是您要查找的内容,但您是否尝试过按照this page 中的说明发布到auth/revoke API?
  • @SteveR 用于管理控制台。我很清楚。我所追求的特别是 /ui ,它只是基本的身份验证。话虽如此,如果有一种方法可以使用 node-red-dashboard 的管理身份验证页面,这可能会起作用,因为从管理页面注销。
  • 对不起,我错过了“仪表板”参考...我过去所做的是使用 ui_control 节点来捕获所有浏览器页面加载和选项卡更改 - 然后重定向到如果未设置某些全局标志(即它们已注销),则主页选项卡。技术含量较低,但用户体验还可以,只要您不需要高安全性即可。

标签: node-red


【解决方案1】:

另请参阅:How to log out user from web site using BASIC authentication?

简而言之,很难从基本身份验证中正确注销,因为基本身份验证并不是真正旨在支持它。正如您在问题中概述的那样,有一些解决方法,但它们有缺点。

虽然 node-red-dashboard 仅支持基本身份验证,但您的选择将受到限制。我们希望能够提供更集成的身份验证机制,但目前还没有做。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多