Ibm mobilefirst IBM MobileFirst 7.1-WL.Server.getActiveUser在设置后立即返回null

Ibm mobilefirst IBM MobileFirst 7.1-WL.Server.getActiveUser在设置后立即返回null,ibm-mobilefirst,mobilefirst-adapters,mobilefirst-server,Ibm Mobilefirst,Mobilefirst Adapters,Mobilefirst Server,这是我正在使用的代码 function createUser(realm, userid, displayName, sessionToken, devicePrint){ var userIdentity = { 'userId' : userid, 'displayName' : displayName, attributes: { 'credentials' : session

这是我正在使用的代码

function createUser(realm, userid, displayName, sessionToken, devicePrint){
    var userIdentity = {
            'userId' : userid,
            'displayName' : displayName, 
            attributes: {
                'credentials' : sessionToken,
                'authenticatedDate' : new Date(),
                'devicePrint' : devicePrint
            }
    };

    LOG.info("Realm = " + realm + "\n UserIdentity = " + JSON.stringify(userIdentity));

    WL.Server.setActiveUser(realm, null);
    WL.Server.setActiveUser(realm, userIdentity);

    var user = WL.Server.getActiveUser(realm);
    LOG.info("User = " + JSON.stringify(user));
}
当我调用WL.Server.setActiveUser(realm,userIdentity)时,一切看起来都很好;(参数都已填充且看起来正确)。在同一领域上调用WL.Server.getActiveUser之后,它立即返回null

我怀疑会话独立模式,但我已确认它设置为false

mfp.session.independent=false
mfp.attrStore.type=httpsession
这是我的过程XML压缩(调用createUser()函数的过程)


验证用户ID
还可能是什么

编辑:authenticationConfig.xml

    <realms>
        <!-- Realm used once authentication completes -->
        <realm loginModule="CustomMFALoginModule" name="CustomMFAAuthenticatorRealm">
            <className>com.worklight.integration.auth.AdapterAuthenticator</className>
            <parameter name="login-function" value="AuthAdapter.onAuthRequired"/>
            <parameter name="logout-function" value="AuthAdapter.logout"/>
        </realm>

        <!-- Realm used on validate user and challenge calls from MFA -->
        <realm loginModule="CustomMFAInitLoginModule" name="CustomMFAAuthenticatorInitRealm">
            <className>com.worklight.integration.auth.AdapterAuthenticator</className>
            <parameter name="login-function" value="AuthAdapter.onAuthRequired"/>
            <parameter name="logout-function" value="AuthAdapter.logout"/>
        </realm>

        <realm loginModule="StrongDummy" name="SampleAppRealm">
            <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
        </realm>

        <realm loginModule="rejectAll" name="SubscribeServlet">
            <className>com.worklight.core.auth.ext.HeaderAuthenticator</className>          
        </realm>                
    </realms>

    <loginModules>
        <loginModule expirationInSeconds="-1" name="CustomMFALoginModule">
            <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
        </loginModule>

        <loginModule expirationInSeconds="-1" name="CustomMFAInitLoginModule">
            <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
        </loginModule>

        <loginModule expirationInSeconds="-1" name="StrongDummy">
            <className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
        </loginModule>

        <loginModule expirationInSeconds="-1" name="requireLogin">
            <className>com.worklight.core.auth.ext.SingleIdentityLoginModule</className>
        </loginModule>

        <loginModule expirationInSeconds="-1" name="rejectAll">
            <className>com.worklight.core.auth.ext.RejectingLoginModule</className>
        </loginModule>              
    </loginModules>

com.worklight.integration.auth.AdapterAuthenticator
com.worklight.integration.auth.AdapterAuthenticator
com.worklight.core.auth.ext.FormBasedAuthenticator
com.worklight.core.auth.ext.HeaderAuthenticator
com.worklight.core.auth.ext.NonValidatingLoginModule
com.worklight.core.auth.ext.NonValidatingLoginModule
com.worklight.core.auth.ext.NonValidatingLoginModule
com.worklight.core.auth.ext.SingleIdentityLoginModule
com.worklight.core.auth.ext.RejectingLoginModule
安全性测试

    <securityTests>
        <customSecurityTest name="MFAAuthenticated-securityTest">
            <test realm="wl_authenticityRealm" step="1"/>
            <test isInternalUserID="true" realm="CustomMFAAuthenticatorRealm" step="1"/>
        </customSecurityTest>

        <customSecurityTest name="SubscribeServlet">
            <test isInternalUserID="true" realm="SubscribeServlet"/>
        </customSecurityTest>
     </securityTests> 

好的,你能试着从fix center下载最新的MFP吗

希望这将是修复,否则你应该作为一个PMR(支持票)处理。打开PMR后,请在问题中注明其编号

更新

对于会话独立模式

mfp.session.independent=false
mfp.attrStore.type=httpsession
浏览器不能很好地工作使用桌面浏览器进行测试


另一件事是,要进行测试,您需要使用模拟器/仿真器或物理设备

能否在authenticationConfig.xml中共享域配置?我在我的本地环境中尝试了相同的代码,并且运行正常。@yogesh我添加了authenticationConfig.xml,对于这个特定的调用,使用的领域是“CustomMFaaAuthenticationInitRealm”,从这里看起来不错。在客户端或服务器端日志中是否有错误?@yogesh当我的代码到达代码的getActiveUser()部分时,当尝试检索设置为用户对象的属性时,我得到的唯一错误是NPE。我没有看到任何Worklight错误或任何东西,这很奇怪。在7.0上一切正常。我不知道是什么原因导致了这个问题。你能试试一个新的mobilefirst项目吗?关于这个补丁,Eclipse插件更新中包括了这些补丁吗?看起来修复程序是1240,我的服务器显示的版本是1240。您在哪里部署了它本地或生产服务器、客户端集模拟器、设备或浏览器。到处都遇到相同的问题?我们有一台websphere主机和本地机,两者都给了我相同的结果。同样发生在基于浏览器的调用以及来自诸如Android、iOS等仿真器的调用中,尽管如此,iOS似乎工作得很好…浏览器并不能更好地工作使用桌面浏览器进行测试。另一件事是,要进行测试,您需要使用仿真器/仿真器或物理设备。
mfp.session.independent=false
mfp.attrStore.type=httpsession