【问题标题】:IBM Worklight 6.1 - Unable to implement logout funcationality in the Desktop Browser webpage environmentIBM Worklight 6.1 - 无法在 Desktop Browser 网页环境中实现注销功能
【发布时间】:2014-03-06 22:11:49
【问题描述】:

我正在尝试为我的 Worklight 应用程序实现注销功能。具体来说,桌面浏览器网页环境。

我的 authenticationConfig.xml 如下:

<resource id="MyApp" securityTest="MyAppTest">
            <urlPatterns>/apps/services/www/MyApp/*</urlPatterns>
         </resource> 

<customSecurityTest name="MyAppTest">
            <test realm="MyAppRealm" isInternalUserID="true"/>
        </customSecurityTest>

<realm name="MyAppRealm" loginModule="MyAppLogin">
            <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
            <parameter name="login-page" value="login.html" />
            <onLoginUrl>/apps/services/www/MyApp/desktopbrowser/default/index.html</onLoginUrl>
</realm>

<loginModule name="MyAppLogin">
            <className> com.worklight.core.auth.ext.RDBMSLoginModule </className>
            <parameter name="dsJndiName" value="jdbc/myapp"/>
            <parameter name="principalsQuery">
            SELECT user_id, password, display_name FROM users WHERE user_id=?
            </parameter>
</loginModule>

到目前为止,我已经尝试过使用 Worklight 客户端 API

WL.Client.logout("MyAppRealm", {onSuccess: WL.Client.reloadApp}); 
WL.Client.logout(null, {onSuccess: WL.Client.reloadApp});

但这不适用于“未定义领域”的错误。谁能建议我为什么会看到“未定义领域”错误?

或者,是否有其他方法可以让用户从我的应用中注销(直接访问会话?)。

【问题讨论】:

  • 你说的是“桌面应用”。您实际在哪个环境中工作? Worklight 中唯一的桌面环境是 Adob​​e AIR。这是你的环境吗?也许您是指 Windows Store 应用?
  • 另外,仅添加您的 authenticationConfig.xml 是不够的;在您尝试登录和注销的地方添加您的实际 JS 代码。
  • 我使用的是桌面浏览器环境,所以我称之为桌面应用。
  • 所以这基本上是 HTML/JS 存在于您的服务器上,并被获取并在您的浏览器上运行。谢谢。请参考我的第二个问题。
  • 另外请告知您当前使用的 Worklight 版本。

标签: security browser ibm-mobilefirst


【解决方案1】:

您正在使用的登录模块在 Worklight 框架 (com.worklight.core.auth.ext.RDBMSLoginModule) 中不再存在。

更多关于如何使用登录模块的信息可以在这里找到: http://www.ibm.com/developerworks/mobile/worklight/getting-started.html#security (寻找基于表单的身份验证、基于适配器的身份验证以及自定义身份验证器和登录模块)。

你也可以看这里: http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/topic/com.ibm.worklight.dev.doc/dev/r_security_framework.html

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-02
  • 2014-05-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多