在移动应用程序中使用 MobileFirst 通过 LDAP 服务器对用户进行身份验证
Using MobileFirst to authenticate users with LDAP server in mobile app
我只编辑 authenticationConfig.xml 和 运行 应用程序
<loginModule expirationInSeconds="-1" name="LDAPLoginModule">
<className>com.worklight.core.auth.ext.LdapLoginModule</className>
<parameter name="ldapProviderUrl" value="**************"/>
<parameter name="ldapTimeoutMs" value="2000"/>
<parameter name="ldapSecurityAuthentication" value="simple"/>
<parameter name="validationType" value="searchPattern"/>
<parameter name="ldapSecurityPrincipalPattern" value="{username}"/>
<parameter name="ldapSearchFilterPattern" value="(&(objectClass=user)(cn={username})(memberof=CN=******,OU=Clients,O=******))"/>
<parameter name="ldapSearchBase" value="OU=Clients,O=******"/>
</loginModule>
当我按下 "Call protected adapter" 时,它会转到 LDAP 登录模块,当我输入用户凭据时,没有任何反应,密码就消失了。
这是日志:
[警告] FWLSE4014W:LdapLoginModule 认证失败。原因'javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 2030, v1db1
在 com.sun.jndi.ldap.LdapCtx.mapErrorCode(来源不明)
在 com.sun.jndi.ldap.LdapCtx.processReturnCode(来源不明)
在 com.sun.jndi.ldap.LdapCtx.processReturnCode(来源不明)
在 com.sun.jndi.ldap.LdapCtx.connect(来源不明)
在 com.sun.jndi.ldap.LdapCtx。(未知来源)
在 com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(未知来源)
在 com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(未知来源)
在 com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(未知来源)
在 com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(未知来源)
在 org.apache.aries.jndi.ContextHelper.getInitialContextUsingBuilder(ContextHelper.java:244)
在 org.apache.aries.jndi.ContextHelper.getContextProvider(ContextHelper.java:208)
在 org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:141)
在 org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:51)
在 javax.naming.spi.NamingManager.getInitialContext(来源不明)
在 javax.naming.InitialContext.getDefaultInitCtx(来源不明)
在 javax.naming.InitialContext.init(来源不明)
在 javax.naming.ldap.InitialLdapContext。(来源不明)
在 com.worklight.core.auth.ext.LdapLoginModule.login(LdapLoginModule.java:158)
在 com.worklight.core.auth.impl.LoginContext.invokeLoginModule(LoginContext.java:252)
在 com.worklight.core.auth.impl.LoginContext.processRequest(LoginContext.java:217)
在 com.worklight.core.auth.impl.AuthenticationContext.processRequest(AuthenticationContext.java:510)
在 com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:182)
在 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:206)
在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
在 com.worklight.analytics.AnalyticsFilter.doFilter(AnalyticsFilter.java:124)
在 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:206)
在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86)
在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:978)
在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1100)
在 com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4730)
在 com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:297)
在 com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981)
在 com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262)
在 com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955)
在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(未知来源)
在 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知来源)
在 java.lang.Thread.run(来源不明)
' [项目 LDAPLoginModule]
[LDAP:错误代码 49 - 8009030C:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext 错误,数据 2030,v1db1
知道问题出在哪里吗?
根据错误日志中提供的异常:LdapLoginModule authentication failed. Reason 'javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0903A9
The error code 49 related to LDAP is caused by the invalid credentials. Please refer to the following most possible causes.
1. The DN path or password which you have specified for the administrator is invalid. Any of the below will result in this error:
1). Pointed to non-user DN
2). Pointed to a non-existent user, but in existing DN
3). Pointed to non existent DN
4). Pointed to an existing user, but non existing DN
5). Pointed to an incorrect admin DN, uid instead of cn
6). Pointed to a non administrator user
7). Pointed to a valid admin but password is incorrect
2. Could not authenticate the user trying to login. This can be the result of an incorrect username or password, or an incorrect prefix and/or suffix specified in the Settings tab, depending on the type of LDAP/AD system. Could also mean the authentication type is incorrect.
我只编辑 authenticationConfig.xml 和 运行 应用程序
<loginModule expirationInSeconds="-1" name="LDAPLoginModule">
<className>com.worklight.core.auth.ext.LdapLoginModule</className>
<parameter name="ldapProviderUrl" value="**************"/>
<parameter name="ldapTimeoutMs" value="2000"/>
<parameter name="ldapSecurityAuthentication" value="simple"/>
<parameter name="validationType" value="searchPattern"/>
<parameter name="ldapSecurityPrincipalPattern" value="{username}"/>
<parameter name="ldapSearchFilterPattern" value="(&(objectClass=user)(cn={username})(memberof=CN=******,OU=Clients,O=******))"/>
<parameter name="ldapSearchBase" value="OU=Clients,O=******"/>
</loginModule>
当我按下 "Call protected adapter" 时,它会转到 LDAP 登录模块,当我输入用户凭据时,没有任何反应,密码就消失了。
这是日志:
[警告] FWLSE4014W:LdapLoginModule 认证失败。原因'javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 2030, v1db1 在 com.sun.jndi.ldap.LdapCtx.mapErrorCode(来源不明) 在 com.sun.jndi.ldap.LdapCtx.processReturnCode(来源不明) 在 com.sun.jndi.ldap.LdapCtx.processReturnCode(来源不明) 在 com.sun.jndi.ldap.LdapCtx.connect(来源不明) 在 com.sun.jndi.ldap.LdapCtx。(未知来源) 在 com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(未知来源) 在 com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(未知来源) 在 com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(未知来源) 在 com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(未知来源) 在 org.apache.aries.jndi.ContextHelper.getInitialContextUsingBuilder(ContextHelper.java:244) 在 org.apache.aries.jndi.ContextHelper.getContextProvider(ContextHelper.java:208) 在 org.apache.aries.jndi.ContextHelper.getInitialContext(ContextHelper.java:141) 在 org.apache.aries.jndi.OSGiInitialContextFactoryBuilder.getInitialContext(OSGiInitialContextFactoryBuilder.java:51) 在 javax.naming.spi.NamingManager.getInitialContext(来源不明) 在 javax.naming.InitialContext.getDefaultInitCtx(来源不明) 在 javax.naming.InitialContext.init(来源不明) 在 javax.naming.ldap.InitialLdapContext。(来源不明) 在 com.worklight.core.auth.ext.LdapLoginModule.login(LdapLoginModule.java:158) 在 com.worklight.core.auth.impl.LoginContext.invokeLoginModule(LoginContext.java:252) 在 com.worklight.core.auth.impl.LoginContext.processRequest(LoginContext.java:217) 在 com.worklight.core.auth.impl.AuthenticationContext.processRequest(AuthenticationContext.java:510) 在 com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:182) 在 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:206) 在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86) 在 com.worklight.analytics.AnalyticsFilter.doFilter(AnalyticsFilter.java:124) 在 com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:206) 在 com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:86) 在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:978) 在 com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1100) 在 com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4730) 在 com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:297) 在 com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981) 在 com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:262) 在 com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:955) 在 java.util.concurrent.ThreadPoolExecutor$Worker.runTask(未知来源) 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(未知来源) 在 java.lang.Thread.run(来源不明) ' [项目 LDAPLoginModule] [LDAP:错误代码 49 - 8009030C:LdapErr:DSID-0C0903A9,注释:AcceptSecurityContext 错误,数据 2030,v1db1
知道问题出在哪里吗?
根据错误日志中提供的异常:LdapLoginModule authentication failed. Reason 'javax.naming.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0903A9
The error code 49 related to LDAP is caused by the invalid credentials. Please refer to the following most possible causes.
1. The DN path or password which you have specified for the administrator is invalid. Any of the below will result in this error:
1). Pointed to non-user DN
2). Pointed to a non-existent user, but in existing DN
3). Pointed to non existent DN
4). Pointed to an existing user, but non existing DN
5). Pointed to an incorrect admin DN, uid instead of cn
6). Pointed to a non administrator user
7). Pointed to a valid admin but password is incorrect
2. Could not authenticate the user trying to login. This can be the result of an incorrect username or password, or an incorrect prefix and/or suffix specified in the Settings tab, depending on the type of LDAP/AD system. Could also mean the authentication type is incorrect.