Android 调用setActiveUser会引发错误
我正在尝试为用户分配一个用户ID,但出现了错误。我遵循以下步骤。 服务器详细信息Android 调用setActiveUser会引发错误,android,authentication,ibm-mobilefirst,mobilefirst-adapters,mobilefirst-server,Android,Authentication,Ibm Mobilefirst,Mobilefirst Adapters,Mobilefirst Server,我正在尝试为用户分配一个用户ID,但出现了错误。我遵循以下步骤。 服务器详细信息 <realm loginModule="AuthLoginModule" name="AuthRealm"> <className>com.worklight.integration.auth.AdapterAuthenticator</className> <parameter name="login-function" value="
<realm loginModule="AuthLoginModule" name="AuthRealm">
<className>com.worklight.integration.auth.AdapterAuthenticator</className>
<parameter name="login-function" value="AuthAdapter.onAuthRequired"/>
<parameter name="logout-function" value="AuthAdapter.onLogout"/>
</realm>
</realms>
<loginModule name="AuthLoginModule">
<className>com.worklight.core.auth.ext.NonValidatingLoginModule</className>
</loginModule>
<customSecurityTest name="AuthSecurityTest">
<test isInternalUserID="true" realm="AuthRealm"/>
</customSecurityTest>
适配器xml
<procedure name="submitAuthentication" securityTest="wl_unprotected" />
<procedure name="getSecretData" securityTest="AuthSecurityTest"/>
}
安卓挑战处理器
public class AndroidChallengeHandler extends ChallengeHandler {
// private Activity parentActivity;
private WLResponse cachedResponse;
public AndroidChallengeHandler( String realm) {
super(realm);
// parentActivity = activity;
}
@Override
public void onFailure(WLFailResponse response) {
try {
submitFailure(response);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onSuccess(WLResponse response) {
submitSuccess(response);
}
@Override
public boolean isCustomResponse(WLResponse response) {
try {
if(response!= null &&
response.getResponseJSON()!=null &&
!response.getResponseJSON().isNull("authStatus") &&
response.getResponseJSON().getString("authStatus") != ""){
return true;
}
} catch (JSONException e) {
e.printStackTrace();
}
return false;
}
@Override
public void handleChallenge(WLResponse response){
cachedResponse = response;
Log.d( "handleChallenge: ---- ",response.getResponseText());
try {
if(response.getResponseJSON().getString("authStatus").equals("credentialsRequired")){
// MainAdapterBasedAuth.setMainText("handleChallenge->credentialsRequired");
// Intent login = new Intent(parentActivity, LoginAdapterBasedAuth.class);
// parentActivity.startActivityForResult(login, 1);
}
else if(response.getResponseJSON().getString("authStatus").equals("complete")){
Log.d( "handleChallenge: ---- ",response.getResponseText());
submitSuccess(cachedResponse);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void submitLogin( String userName, String password){
Object[] parameters = new Object[]{userName, password};
WLProcedureInvocationData invocationData = new WLProcedureInvocationData("AuthAdapter", "submitAuthentication");
invocationData.setParameters(parameters);
WLRequestOptions options = new WLRequestOptions();
options.setTimeout(30000);
submitAdapterAuthentication(invocationData, options);
}
}
实际上,在活动1中,我正在调用一个,它将初始化wlclient并添加领域
MFPInitializer.getInstance().mfpInit(getApplicationContext());
但是,当我试图在mobile first平台上向setuser提交登录到设备时,我的应用程序崩溃了
MFPInitializer MFPInitializer=MFPInitializer.getInstance()
我得到以下错误
在安卓显示器上
ava.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.worklight.wlclient.WLRequest.shouldFailOnChallengeCancel()' on a null object reference
关于eclipse(MFP)
上述错误已得到解决,但mobilefirst控制台中未更新新用户ID
您能告诉我哪里出错了吗。如评论中所述,此问题通过从IBM Fix Central网站更新到最新可用的iFix版本得到解决。如评论中所述,通过从IBM Fix Central网站更新到最新可用的iFix版本,此问题得以解决。bender,您是否解决了此错误?此问题通过使用MFP插件的最新更新得以解决。请将此作为问题的答案,说明您现在安装的版本号?您是否解决了此错误,bender?这个问题通过最新的MFP插件更新得到了解决。介意写下这个作为问题的答案,说明你现在安装的版本号吗?
MFPInitializer.getInstance().mfpInit(getApplicationContext());
mfpInitializer.challengeHandler.submitLogin("user","Passcode");
ava.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.worklight.wlclient.WLRequest.shouldFailOnChallengeCancel()' on a null object reference
An error occurred while invoking procedure [project _MFP]AuthAdapter/submitAuthenticationFWLSE0100E: parameters: [project _MFP]
Cannot change identity of an already logged in user in realm 'AuthRealm'. The application must logout first.
FWLSE0101E: Caused by: [pro