I need synchronize with LDAP few extra attributes for users.
I found that Script Runner 5.7+ you can add resources = ldap.
https://scriptrunner.adaptavist.com/latest/jira/resources.html#_ldap_connection
But I cannot run sample code to get something from LDAP.
My code:
import com.onresolve.scriptrunner.ldap.LdapUtil
import org.springframework.ldap.core.AttributesMapper
import javax.naming.directory.SearchControls
import javax.naming.directory.Attributes
import org.springframework.ldap.filter.AndFilter;
import org.springframework.ldap.filter.EqualsFilter;
def base="DC=ad,DC=net"
def filter="(&(objectCategory=Person)(memberOf=CN=GroupName,OU=Apps,OU=Groups,OU=Tenants,DC=ad,DC=net))"
def cnList = LdapUtil.withTemplate('users') { template ->
template.search(base,filter, SearchControls.SUBTREE_SCOPE, { Attributes attributes ->
attributes.get('cn').get()
} as AttributesMapper<String>)
}
Output:
[LDAP: error code 32 - 0000208D: NameErr: DSID-03100288, problem 2001 (NO_OBJECT), data 0, best match of: 'DC=ad,DC=net' ]; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - 0000208D: NameErr: DSID-03100288, problem 2001 (NO_OBJECT), data 0, best match of: 'DC=ad,DC=net' ]; remaining name 'DC=ad,DC=net'
Base in code is the same as Base in LDAP resource entry.
Hi all,
We have an upcoming feature that will allow you to specify environment properties for the LDAP connection: this includes setting the referral mode. Please feel free to watch the linked development ticket and comment there with any questions.
Joanna Choules, Adaptavist Product Support
(c.c. @[deleted], @apuskarcik)
For our system configuration user directory right now is like this:
Use SSL, but in advanced section we have disabled: Secure SSL and also Fallow Referrals. I don't know how to set this via script runner resources.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Rafał Żydek , @Joanna Choules ,
Any updates on this matter? We are having a similar issue and would like to turn off Follow Referrals.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dino Carreon I saw that you done this some time ago. Right now, when I use example code:
import com.onresolve.scriptrunner.ldap.LdapUtil
import org.springframework.ldap.core.AttributesMapper
import javax.naming.directory.SearchControls
import javax.naming.directory.Attributes
def cnList = LdapUtil.withTemplate('users') { template ->
template.search("", "(sn=Smi*)", SearchControls.SUBTREE_SCOPE, { Attributes attributes ->
attributes.get('cn').get()
} as AttributesMapper<String>)
}
I've got this error:
org.springframework.ldap.PartialResultException: Unprocessed Continuation Reference(s); nested exception is javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '' at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:216) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:385) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:328) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:604) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:594) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:482) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:498) at Script207$_run_closure1.doCall(Script207.groovy:7) at com.sun.proxy.$Proxy4582.apply(Unknown Source) at java_util_function_Function$apply.call(Unknown Source) at com.onresolve.scriptrunner.ldap.DefaultLdapConnectionManager.withTemplate(DefaultLdapConnectionManager.groovy:41) at com.onresolve.scriptrunner.ldap.LdapConnectionManager$withTemplate$1.callCurrent(Unknown Source) at com.onresolve.scriptrunner.ldap.DefaultLdapConnectionManager.withTemplateTracked(DefaultLdapConnectionManager.groovy:48) at com.onresolve.scriptrunner.ldap.LdapConnectionManager$withTemplateTracked$0.call(Unknown Source) at com.onresolve.scriptrunner.ldap.LdapUtil.withTemplate(LdapUtil.groovy:13) at Script207.run(Script207.groovy:6) Caused by: javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name '' at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source) at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.getNextBatch(Unknown Source) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMoreImpl(Unknown Source) at com.sun.jndi.ldap.AbstractLdapNamingEnumeration.hasMore(Unknown Source) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:365) ... 14 more
Can you help me with this?
Or you @Joanna Choules
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rafał,
This Stack Overflow post suggests a couple of ways to resolve this error: changing the port number can be done by editing the config of your LDAP connection in the Resources tab, while changing the referral mode is currently not supported but I will raise it as a request with our development team.
Best wishes,
Joanna Choules, Adaptavist Product Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Joanna Choules ,
are there any news on the integration of the referral mode?
And alternatively:
Is there a way of setting the Adaptavist Script Runner Config to this property as this is another suggested fix for the Partial Exception Error?
ignorePartialResultExcepton = true
Best,
Clemens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think this is because, there is no account starting with 'Smi' available or just a single one. I don't know how to cope with this one...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.