By: Arda Akinci user 31 Aug 2022 at 12:18 a.m. CDT

13 Responses
Arda Akinci gravatar
Hi Team, When I add ldap using the `/restv1/api/v1/configuration/ldap` API; > 2022-08-31 05:08:24,461 INFO [qtp733943822-4338] [oxtrust.api.server.api.impl.BaseWebResource] (BaseWebResource.java:33) - Create a new configuration I get the above log but ldap is not added. My POST request is as follows; > curl -X POST -k -H 'Authorization: Bearer 679b6e8b-7897-4ee7-9acf-468d85df199c' -d ' { "configId":"new-ldap", "bindDN":"uid=ccc,ou=Users,o=6f7406350,dc=cloud,dc=com", "bindPassword":"dW", "servers":[ "ldap.com:636" ], "maxConnections":2, "useSSL":true, "baseDNs":[ "ou=Users,o=5d2a3745fd4d0,dc=cloud,dc=com" ], "primaryKey":"uid", "localPrimaryKey":"uid", "enabled": true, "level": 0 } ' -H "Content-Type: application/json" https://gluu.gluu/identity/restv1/api/v1/configuration/ldap > thanks for help.

By Mobarak Hosen Shakil staff 31 Aug 2022 at 12:49 a.m. CDT

Mobarak Hosen Shakil gravatar
Hi Arda, Did you check at `Manage Authentication / Manage LDAP Authentication` of gluu server UI? Can you please share a screenshot? Regards ~ Shakil

By Arda Akinci user 31 Aug 2022 at 12:58 a.m. CDT

Arda Akinci gravatar
yes, i checked before. but those added via API are not listed here.

By Mobarak Hosen Shakil staff 31 Aug 2022 at 9:18 p.m. CDT

Mobarak Hosen Shakil gravatar
Thanks Arda, Can you please share the `client-config` that you are using to generate the `token`?

By Arda Akinci user 01 Sep 2022 at 1:01 a.m. CDT

Arda Akinci gravatar
Okey. I am using the client below to create tokens. Thanks for your help. OPENID CONNECT CLIENTS DETAILS ------------------------------ - **Name:** test - **Client ID:** 106d18b6-xxxx-403a-bafe-0960cfad9e14 - **Subject Type:** pairwise - **ClientSecret:** XXXXXXXXXXX - **Application Type:** web - **Persist Client Authorizations:** true - **Pre-Authorization:** false - **Authentication method for the Token Endpoint:** client_secret_basic - **Logout Session Required:** false - **Include Claims In Id Token:** false - **Disabled:** false - **Logout Redirect URIs:** [https://gluu.gluu] - **Login Redirect URIs:** [https://gluu.gluu, https://gluu.gluu] - **Scopes:** [profile, openid, offline_access, user_role, permission] - **Grant types:** [authorization_code, refresh_token, client_credentials] - **Response types:** [code, token, id_token]

By Arda Akinci user 05 Sep 2022 at 1:26 a.m. CDT

Arda Akinci gravatar
Hi again, How can I make these configurations in the machine without using the gluu server api? Which files should I add configuration to on Gluu server? Thanks,

By Arda Akinci user 05 Sep 2022 at 3:11 a.m. CDT

Arda Akinci gravatar
When I change the log level, the logs I see are as follows; ``` 2022-09-05 08:04:07,232 INFO [qtp222511810-18994] [oxtrust.api.server.api.impl.BaseWebResource] (BaseWebResource.java:33) - Create a new configuration 2022-09-05 08:04:07,232 DEBUG [qtp222511810-18994] [oxtrust.api.server.api.impl.BaseWebResource] (BaseWebResource.java:29) - ++++++++++API-ERROR java.lang.NullPointerException: null at org.gluu.oxtrust.api.server.model.ExistingLdapConfigurationValidator.isInvalid(ExistingLdapConfigurationValidator.java:19) ~[api-server.jar:?] at org.gluu.oxtrust.api.server.api.impl.LDAPAuthenticationWebResource.createLdapConfiguration(LDAPAuthenticationWebResource.java:94) ~[api-server.jar:?] at org.gluu.oxtrust.api.server.api.impl.LDAPAuthenticationWebResource$Proxy$_$$_WeldSubclass.createLdapConfiguration$$super(Unknown Source) ~[api-server.jar:?] at jdk.internal.reflect.GeneratedMethodAccessor1390.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.jboss.weld.interceptor.proxy.TerminalAroundInvokeInvocationContext.proceedInternal(TerminalAroundInvokeInvocationContext.java:51) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.jboss.weld.interceptor.proxy.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:78) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.hibernate.validator.internal.cdi.interceptor.ValidationInterceptor.validateMethodInvocation(ValidationInterceptor.java:79) ~[hibernate-validator-cdi-5.4.3.Final.jar:5.4.3.Final] at jdk.internal.reflect.GeneratedMethodAccessor1387.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.jboss.weld.interceptor.reader.SimpleInterceptorInvocation$SimpleMethodInvocation.invoke(SimpleInterceptorInvocation.java:73) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeAroundInvoke(InterceptorMethodHandler.java:84) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.executeInterception(InterceptorMethodHandler.java:72) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.jboss.weld.interceptor.proxy.InterceptorMethodHandler.invoke(InterceptorMethodHandler.java:56) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:79) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.jboss.weld.bean.proxy.CombinedInterceptorAndDecoratorStackMethodHandler.invoke(CombinedInterceptorAndDecoratorStackMethodHandler.java:68) ~[weld-core-impl-3.1.4.Final.jar:3.1.4.Final] at org.gluu.oxtrust.api.server.api.impl.LDAPAuthenticationWebResource$Proxy$_$$_WeldSubclass.createLdapConfiguration(Unknown Source) ~[api-server.jar:?] at org.gluu.oxtrust.api.server.api.impl.LDAPAuthenticationWebResource$Proxy$_$$_WeldClientProxy.createLdapConfiguration(Unknown Source) ~[api-server.jar:?] at jdk.internal.reflect.GeneratedMethodAccessor1386.invoke(Unknown Source) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:138) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:543) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:432) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$0(ResourceMethodInvoker.java:393) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:395) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:364) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:337) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:440) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:229) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:135) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.interception.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:358) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:138) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:215) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:245) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:61) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) ~[resteasy-jaxrs-3.13.0.Final.jar:3.13.0.Final] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[servlet-api-3.1.jar:3.1.0] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:791) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1626) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:228) ~[websocket-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:193) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1601) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:602) ~[jetty-security-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1435) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501) ~[jetty-servlet-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1350) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.Server.handle(Server.java:516) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388) ~[jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633) [jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380) [jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) [jetty-server-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [jetty-io-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [jetty-io-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:773) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:905) [jetty-util-9.4.35.v20201120.jar:9.4.35.v20201120] at java.lang.Thread.run(Thread.java:834) [?:?] ```

By Mobarak Hosen Shakil staff 05 Sep 2022 at 6:54 p.m. CDT

Mobarak Hosen Shakil gravatar
Did you try at gluu-server GUI? Does that work?

By Arda Akinci user 06 Sep 2022 at 5:42 p.m. CDT

Arda Akinci gravatar
Yes. When I click the Test Ldap Connection button: !**LDAP Connection Test succeeded!**' alert

By Arda Akinci user 07 Sep 2022 at 5:37 a.m. CDT

Arda Akinci gravatar
Is this a correct POST request? ``` curl -X POST -k -H 'Authorization: Bearer 679b6e8b-7897-4ee7-9acf-468d85df199c' -d ' { "configId":"new-ldap", "bindDN":"uid=ccc,ou=Users,o=6f7406350,dc=cloud,dc=com", "bindPassword":"dW", "servers":[ "ldap.com:636" ], "maxConnections":2, "useSSL":true, "baseDNs":[ "ou=Users,o=5d2a3745fd4d0,dc=cloud,dc=com" ], "primaryKey":"uid", "localPrimaryKey":"uid", "enabled": true, "level": 0 } ' -H "Content-Type: application/json" https://gluu.gluu/identity/restv1/api/v1/configuration/ldap ``` Best, Regards

By Mobarak Hosen Shakil staff 09 Sep 2022 at 10:07 p.m. CDT

Mobarak Hosen Shakil gravatar
Hi Arda, It seems okay to me. servers: [ "ldap.com:636" ], Did you test it from your gluu-server? does connection work between your gluu server and this ldap server? > https://support.gluu.org/cache-refresh/10747/adding-new-ldap-using-gluu-server-apis/#at78444 Regards ~ Shakil

By Arda Akinci user 10 Sep 2022 at 4:11 p.m. CDT

Arda Akinci gravatar
Hello Mobarak, Thanks for the answer. I'm trying the LDAP configuration with API, which I tried and successfully added via the gluu gui. I didn't add my actual configurations to the ticket(for security). Is there any other way to do this? (like adding to local files on the gluu machine) Best, Regards

By Mobarak Hosen Shakil staff 20 Sep 2022 at 12:26 a.m. CDT

Mobarak Hosen Shakil gravatar
Hi Arda, Did you face any issue while adding backend LDAP using Gluu GUI? is there any possibility to use Gluu GUI for adding Backend LDAP?

By Arda Akinci user 20 Sep 2022 at 12:56 a.m. CDT

Arda Akinci gravatar
Hi Mobarak, Yes, I have successfully added from Gluu GUI.