Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ibm mobilefirst LDAP示例\u需要帮助吗_Ibm Mobilefirst_Worklight Security - Fatal编程技术网

Ibm mobilefirst LDAP示例\u需要帮助吗

Ibm mobilefirst LDAP示例\u需要帮助吗,ibm-mobilefirst,worklight-security,Ibm Mobilefirst,Worklight Security,我正在进行LDAP身份验证。我从IBM WorkLink基金会启动网站下载了这个例子。 在所有的配置等之后,我看到LDAP不工作 根据示例,getSecretData方法应该在登录表单的成功身份验证之后执行 但即使我给出了错误的凭证,它也会让我使用getSecretData方法 请帮忙 在那里找到代码 HTML页面: <div id="AppDiv"> <div class="header"> <h1>LDAPA

我正在进行LDAP身份验证。我从IBM WorkLink基金会启动网站下载了这个例子。 在所有的配置等之后,我看到LDAP不工作

根据示例,getSecretData方法应该在登录表单的成功身份验证之后执行

但即使我给出了错误的凭证,它也会让我使用getSecretData方法

请帮忙

在那里找到代码

HTML页面:

    <div id="AppDiv">
        <div class="header">
            <h1>LDAPApp</h1>
        </div>  
        <div class="wrapper">
            <input type="button" value="Call protected adapter proc" onclick="getSecretData()" />
            <input type="button" value="Logout" onclick="WL.Client.logout('LDAPRealm',{onSuccess: WL.Client.reloadApp})" />
        </div>
        <div id="resultDiv"></div>
    </div>

    <div id="AuthDiv" style="display:none">
        <div id="loginForm">
            Username:<br/>
            <input type="text" id="usernameInputField" value=""/><br />
            Password:<br/>
            <input type="password" id="passwordInputField" value=""/><br/>      
            <input type="button" id="loginButton" value="Login" />
            <input type="button" id="cancelButton" value="Cancel" />
        </div>
    </div>

    <script src="js/initOptions.js"></script>
    <script src="js/LDAPApp.js"></script>
    <script src="js/messages.js"></script>
    <script src="js/LDAPRealmChallengeHandler.js"></script>
</body>
LDAPRealmChallengeHandler.js

var LDAPRealmChallengeHandler = WL.Client.createChallengeHandler("LDAPRealm");

LDAPRealmChallengeHandler.isCustomResponse = function(response) {
if (!response || !response.responseText) {
    return false;
}

var idx = response.responseText.indexOf("j_security_check");

if (idx >= 0){ 
    return true;
}
return false;

};

LDAPRealmChallengeHandler.handleChallenge = function(response){
    $('#AppDiv').hide();
    $('#AuthDiv').show();
    $('#passwordInputField').val('');
}; 

$('#loginButton').bind('click', function () {
var reqURL = '/j_security_check';
var options = {};
options.parameters = {
        j_username : $('#usernameInputField').val(),
        j_password : $('#passwordInputField').val()
};
options.headers = {};
LDAPRealmChallengeHandler.submitLoginForm(reqURL, options,    LDAPRealmChallengeHandler.submitLoginFormCallback);
});

$('#cancelButton').bind('click', function () {
$('#AppDiv').show();
$('#AuthDiv').hide();
LDAPRealmChallengeHandler.submitFailure();
});

 LDAPRealmChallengeHandler.submitLoginFormCallback = function(response) {
var isLoginFormResponse = LDAPRealmChallengeHandler.isCustomResponse(response);
if (isLoginFormResponse){
    LDAPRealmChallengeHandler.handleChallenge(response);
} else {
    $('#AppDiv').show();
    $('#AuthDiv').hide();
    LDAPRealmChallengeHandler.submitSuccess();
}
};

LDAPApp.js 

 function wlCommonInit(){
// Common initialization code goes here
}

 function getSecretData(){
 var invocationData = {
        adapter: "DummyAdapter",
        procedure: "getSecretData",
        parameters: []
 };

 WL.Client.invokeProcedure(invocationData, {
    onSuccess: getSecretData_Callback,
    onFailure: getSecretData_Callback,
    timeout: 2000
 });
 }

 function getSecretData_Callback(response){
  $("#resultDiv").html(new Date() + "<hr/>");
  $("#resultDiv").append("Secret data :: " + response.invocationResult.secretData);
 }

  DummyAdaptor.xml 

 <displayName>DummyAdapter</displayName>
  <description>DummyAdapter</description>

 <connectivity>
 <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
  <protocol>http</protocol>
  <domain>none</domain>
  <port>80</port>     
 </connectionPolicy>
 <loadConstraints maxConcurrentConnectionsPerNode="2" />
 </connectivity>

 <procedure name="getSecretData"  securityTest="LDAPSecurityTest" />
 </wl:adapter>
DummyAdapter-impl.js

  function getSecretData(){
    return {secretData: 1234};
  }

   authenticationConfig.xml 

   <securityTests>
    <customSecurityTest name="LDAPSecurityTest">
        <test realm="wl_directUpdateRealm" step="1"/>
        <test isInternalUserID="true" realm="LDAPRealm"/>
    </customSecurityTest>

 </securityTests>
 <realms>
    <realm loginModule="LDAPLoginModule" name="LDAPRealm">
        <className>com.worklight.core.auth.ext.FormBasedAuthenticator</className>
        <onLoginUrl>/console</onLoginUrl>
    </realm>
 </realms>
 <loginModules>
    <loginModule name="rejectAll">
        <className>com.worklight.core.auth.ext.RejectingLoginModule</className>
    </loginModule>
    <loginModule name="LDAPLoginModule">
        <className>com.worklight.core.auth.ext.LdapLoginModule</className>
        <parameter name="ldapProviderUrl" value="ldap://xyz"/>
        <parameter name="ldapTimeoutMs" value="120000"/>
        <parameter name="ldapSecurityAuthentication" value="none"/>
        <parameter name="validationType" value="exists"/>
        <parameter name="ldapSecurityPrincipalPattern" value="{username}@in.ibm.com"/>
        <parameter name="ldapSearchFilterPattern" value="(&amp;(mail=%v)(|(objectclass=ibmPerson)(objectclass=eperson)))"/>
        <parameter name="ldapSearchBase" value="c=in,ou=bluepages,o=ibm.com"/>
    </loginModule>
</loginModules>
</tns:loginConfiguration>
不知道哪里不对。在控制台中获取以下错误。但它允许我访问getSecretData,即使我给出了错误的Credentail

[错误]FWLSE0048E:捕获到未处理的异常:SRVE0190E:文件未处理 找到:/console java.io.FileNotFoundException:SRVE0190E:文件未找到 找到:/console位于 com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.HandlerRequestDefaultExtensionProcessor.java:528 在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTargetWebAppFilterChain.java:127 在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilterWebAppFilterChain.java:88 在 com.worklight.core.auth.impl.AuthenticationFilter$1.executeAuthenticationFilter.java:205 在 com.worklight.core.auth.impl.AuthenticationServiceBean.accessResourceAuthenticationServiceBean.java:76 在 com.worklight.core.auth.impl.AuthenticationFilter.doFilterAuthenticationFilter.java:209 在 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilterFilterInstanceWrapper.java:194 在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilterWebAppFilterChain.java:85 在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilterWebAppFilterManager.java:968 在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokefilterswebapfiltermanager.java:1056 在 com.ibm.ws.webcontainer.webapp.webapp.handleRequestWebApp.java:4510 在 com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequestDynamicVirtualHost.java:282 在 com.ibm.ws.webcontainer.webcontainer.handleRequestWebContainer.java:954 在 com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.runDynamicVirtualHost.java:252 在 com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.runHttpDispatcherLink.java:584 位于com.ibm.ws.threading.internal.Worker.ExecuteWorker.java:439 com.ibm.ws.threading.internal.Worker.runWorker.java:421 at java.lang.Thread.runUnknown源[项目 模块\u 23\u 2\u LDAPLoginModule]SRVE0190E:找不到文件:/console


您不需要在领域定义中指定onLoginUrl,只需删除它即可。它用于在成功登录后将客户端转发到特定位置,这与移动应用无关

请显示DummAdapter XML文件。您确实将安全测试添加到了getSecretData中吗?请查看Marcel Stor的这篇博文: