Getting exception while updating user groups from SSL enabled AD directory

Hi,

I am trying to update the groups of the User from connected AD Directory(with SSL) and I getting the ClassNotFoundException.

Here is the snapshot of the code:-

UserAccessor userAccessor = (UserAccessor) ContainerManager.getComponent(“userAccessor”);
userAccessor.addMembership(group, user);

ERROR:-

com.atlassian.confluence.user.UserManagementOperationFailedException: java.lang.ClassNotFoundException: com.atlassian.crowd.directory.ssl.LdapHostnameVerificationSSLSocketFactory not found by com.demoproject.sso.saml.confluence-sso [272]
at com.atlassian.confluence.user.DefaultUserAccessor.addMembership(DefaultUserAccessor.java:201)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
at

Did you ever find a solution for this? I’m having the same problem and can’t seem to find much about it.

You need to set LdapHostnameVerificationSSLSocketFactory class in the current thread and Confluence Sysadmin user in the AuthenticatedUserThreadLocal (for permission to update user).

Try this code

Thread currentThread = Thread.currentThread();
ClassLoader classLoader= currentThread.getContextClassLoader();
currentThread.setContextClassLoader(LdapHostnameVerificationSSLSocketFactory.class.getClassLoader());
AuthenticatedUserThreadLocal.set(“Confluence Sys admin username”);
userAccessor.addMembership(“group_name”, “username”);

2 Likes

Thanks Lokesh for your solution. :grinning:
I also shared the link of this page to JRASERVER-42868