未知的境界[MYREALM。空返回键:isUserAuthenticated [英] Unknown realm [myRealm]. null returned for key: isUserAuthenticated

查看:126
本文介绍了未知的境界[MYREALM。空返回键:isUserAuthenticated的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用IBM工作灯6.1,并试图检查用户进行身份验证或不:

I am using IBM Worklight 6.1 and trying to check if the user is authenticated or not:

我在定义一个领域服务器/ conf目录/ authenticationConfig.xml

<realm name="myRealm" loginModule="myLoginModule">
<className>com.worklight.integration.auth.AdapterAuthenticator</className>
<parameter name="login-function" value="authentication.onAuthRequired" />
<parameter name="logout-function" value="authentication.onLogout" />
</realm>

和它的登录模块

<loginModule name="myLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule>

和,甚至在那之前登录,当我尝试检查,如果用户进行身份验证或不使用后

and after logging in, or even before that, when I try to check if the user is authenticated or not using

WL.Client.isUserAuthenticated("myRealm")

我有以下响应

 Unknown realm [myRealm]. null returned for key: isUserAuthenticated 

任何人有这种想法?
是不是有什么毛病我境界定义?
有没有更好的方法来检查,如果用户进行身份验证?

Anyone have an idea about that ? Is there something wrong with my Realm definition ? Is there a better way to check if a user is authenticated ?

推荐答案

你第一次调用 WL.Client.updateUserInfo();

从文档:

updateUserInfo(选项)

updateUserInfo(options)

这个方法发生异常后,刷新用户数据。使用此方法
  当应用程序调用后收到异常
  invokeProcedure()方法。该方法刷新的数据
  以下方法:

This method refreshes user data after an exception. Use this method when the application receives an exception after calling the invokeProcedure() method. The method refreshes the data for the following methods:

WL.Client.getUserName(境界)结果
  WL.Client.getLoginName(境界)结果
  WL.Client.isUserAuthenticated(境界)

WL.Client.getUserName(realm)
WL.Client.getLoginName(realm)
WL.Client.isUserAuthenticated(realm)

这样的异常后,您可以验证用户身份验证状态
  通过首先调用该函数,然后isUserAuthenticated()
  方法。

After such an exception, you can verify the user authentication status by calling this function first, and then the isUserAuthenticated() method.

参数:选项 - 可选。一个标准的选择对象。

Parameters: options - Optional. A standard options object.

这篇关于未知的境界[MYREALM。空返回键:isUserAuthenticated的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆