作業中のサンプル アプリでアダプター認証を使用しています。起動時にログインページが必要だったのでWL.Client.Login
、jsファイルでこれを使用しました
関数 wlCommonInit(){
WL.Client.login("AuthRealm", {onSuccess: winFunction, onFailure: failureFunction});
}
チャレンジャーハンドラーを呼び出し、以下の関数が呼び出されています
$("#AuthSubmitButton").bind('click', function () {
var username = $("#AuthUsername").val();
var password = $("#AuthPassword").val();
console.log("called");
var invocationData = {
adapter : "Auth",
procedure : "submitAuthentication",
parameters : [username,password ]
};
したがって、このような入力を取得している Adapter-impl.js ファイルに移動します。
var auth = WL.Server.createSQLStatement("select * FROM users WHERE Username = ? AND Password = ? ;");
function submitAuthentication(username,password){
return WL.Server.invokeSQLStatement({
preparedStatement :auth,
parameters : [username,password],
});
}
問題は、起動時にログインページが正常に表示され、アダプターファイルにも移動することです。ユーザーIDをどこで作成でき、パラメーターを受け入れないのかわかり WL.Server.setActiveUser("AdapterAuthRealm", userIdentity);
ませWL.Server.invokeSQLStatement
んonsuccess
。
Worklight の SQL アダプター認証に使用できる例はありません。ですから、質問するしかありませんでした。これで私を助けてください!