0

Worklight でアダプター・ベースの認証を作成しようとしています。レルム、セキュリティ テスト、およびログイン モジュールを authenticationConfig ファイルに追加しました。IBM が提供するモジュールに従ってみました。WL.Server.setActiveUser メソッドの正確な構文とハードコードされた値をコピーしました。しかし、引き続きエラーが発生します。このメソッドを使用できる特定の範囲はありますか? 誰かが私のエラーがどこにあるかを見たり知っていますか?

次のエラーが引き続き発生します。

LOG: Request [login] 
LOG: Request [/apps/services/api/GPC2/android/query] 
LOG: response [/apps/services/api/GPC2/android/query] success: /*-secure-
{"responseID":"1","isSuccessful":true,"resultSet REMOVED LINE THAT CONTAINED DB RESULTS FOR     SECURITY
[/apps/services/api/GPC2/android/query] exception. 
SCRIPT5007: Unable to get value of the property 'setActiveUser': object is null or undefined 

var lname= responseData.invocationResult.resultSet[0].somelastname;
var gpcid = responseData.invocationResult.resultSet[0].someid;
var fname = responseData.invocationResult.resultSet[0].somefname;
WL.Logger.debug("Login :: SUCCESS" + lname + " " + gpcid + " " + fname);  //this line does write the values to the log

//WL.Client.login("NotificationsRealm");
WL.Server.setActiveUser ("NotificationsRealm", {
userId: gpcid,
displayName: fname,
attributes: {
firstName: fname,
lastName : lname,
isUserAuthenticated: 1,
}
});
4

1 に答える 1

0

WL.Server.setActiveUserのAPIドキュメントを見ると、次のようになっているはずです。

WL.Server.setActiveUser ("ACMERealm", {
    userId: "38017840288",
    displayName: "John Doe",
    attributes: {
        "firstName": "John",
        "lastName": "Doe",
        "lastLogin": "2010-07-13 19:25:08.0 GMT",
    }
})

属性の二重引用符が欠落しているように見えますか?

于 2013-03-14T17:14:33.257 に答える