#1 2022-04-13 06:50:19

Gopisrinivasan
Member
Registered: 2022-04-12

Getting Exception when connecting LDAP Active directory from Groovy

Hi Team,
We are trying to connect Azure Active directory from groovy script engine, when we try to execute the below code, we are getting the below mentioned exception.

def ldap = LDAP.newInstance('http://ldap.server.com:389', 'cn=Sample CN, ou=SampleOU DC=SampleDC', 'MyPassword')

Exception :
Exception in thread "main" groovy.lang.MissingPropertyException: No such property: LDAP for class: Com.Test.Demo.MyFirstGroovyClass
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:67)
    at org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.unwrap(IndyGuardsFiltersAndSignatures.java:172)
    at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
    at Com.Test.Demo.MyFirstGroovyClass.LDAPConnect(MyFirstGroovyClass.groovy:50)
    at org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:318)
    at Com.Test.Demo.MyFirstGroovyClass.main(MyFirstGroovyClass.groovy:37)

Also anyone please tell us the steps to implement SSO (Example : Separate Login screen or any other way)
Thanks & Regards,
Gopi S

Offline

#2 2022-04-14 12:21:05

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

the LDAP variable is not defined correctly. If it uses an external object, you have to import it. Pls also take a look at our script guide here: https://reportserver.net/en/guides/script/main/

Regards,
Eduardo

Offline

#3 2022-04-18 10:14:53

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Team,
Thanks for the response. I have gone through the document and i am having query on the below points
1. How do we login, since its SSO authentication from where we need to call Groovy script
2. Do we need create any new login page

Please provide steps to do SSO

Offline

#4 2022-04-19 06:08:30

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Team,
I have implemented the steps, as you shared in the previous chat [https://reportserver.net/en/guides/script/main/] to connect SSO using LDAP Active directory.

Steps we did :
1. We have downloaded, the three files [ldapimport.groovy, hookldappam.groovy and sso/ldap.cf] to my computer.
2. Open the sso/ldap.cf with a text editor and change the configuration options to match your configuration (I have updated LDAP details and my username in the user attribute)
[<user>
      <objectClass>inetOrgPerson</objectClass>
      <firstname>xxx</firstname>
      <lastname>xxx</lastname>
      <username>xxx</username>
      <mail>xxx</mail>
    </user>
3. Upload both .groovy files to a location below the bin directory. Open the terminal by pressing CTRL+ALT+T. Upload the sso/ldap.cf to the /etc directory.
4. Change the current directory to the location where i put the script files using the cd command and executed the below import script.
a. cd /fileserver/bin
    exec -c ldapimport.groovy
b. cd /fileserver/bin
     exec hookldappam.groovy
5. Logout Reportserver and try to login with my account updated in the sso/ldap.cf file.
6. I could not able to login

Please help me to resolve the issue.

Offline

#5 2022-04-19 09:24:03

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

what is the output of "ldaptest filter", "ldaptest users"? etc  Pls refer here: https://reportserver.net/releasenotes/R … l#ldaptest

Regards,
Eduardo

Offline

#6 2022-04-19 09:50:59

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
I have tried the link which you have given and put the below command
"ldaptest filter" and "ldaptest users". i am getting the result as "command not found".

Please help on this

Offline

#7 2022-04-19 09:54:13

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

you need version 4.1.0 for these commands to work.

Regards,
Eduardo

Offline

#8 2022-04-19 10:26:04

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi eduardo,
Thanks for the update, currently we are using version (RS3.7.1-6052)in the report server. Hence to implement SSO, do we need to install 4.1.0 right.

Please confirm

Offline

#9 2022-04-19 11:34:37

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

in older versions you can use the legacy ldap script here: https://github.com/infofabrik/reportser … ort.groovy

Pls note that this the new ldapimport and ldaptest commands are much easier to configure.

Anyhow, we always recommend to upgrade to the latest version. If you want to use LDAP this is even more a reason to upgrade.

Regards,
Eduardo

Offline

#10 2022-04-19 12:20:54

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
Thanks for the update, we already developed lot of reports including Crystal report in the Report server (3.7.1), if we upgrade to 4.1.0, whether it will have any impact for the existing reports. if no other impact, then could you please provide the link to download the package for 4.1.0.

Also please confirm, if we are using 3.7.1 version and legacy ldap script, then what are the steps do we need to follow.
Please advise on this

Thanks & Regards,
Gopi S

Offline

#11 2022-04-20 06:08:40

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Team,
Could you please confirm, whether we need to enter username and password to login, even though we have implement SSO authentication with LDAP.

Offline

#12 2022-04-20 08:52:07

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

you can always download the newest version from here: https://reportserver.net/de/download/ or from our support portal.
Your reports should work after the upgrade, but of course a backup is needed anyway. Here you have the upgrade guide:
https://reportserver.net/en/tutorials/upgrade-30/

If you use the legacy script, you have to adapt it to work for your specific LDAP installation. In most of the cases, this is needed:

the ldap script provided is just a template which has to be changed / adapted to your specific ldap configuration. Pls take a look here: https://forum.reportserver.net/viewtopic.php?id=710 and https://forum.reportserver.net/viewtopic.php?id=711

In most of the cases, these methods / parameters should be adapted. Pls check below for a jumpcloud ldap example:

1. Credentials:

lul.setProviderUrl("ldap://ldap.jumpcloud.com:389");
lul.setSecurityPrincipal("uid=LDAP_BINDING_USER,ou=Users,o=YOUR_ORG_ID,dc=jumpcloud,dc=com"); // replace LDAP_BINDING_USER and YOUR_ORG_ID with your account details
lul.setSecurityCredentials("******"); //your password

2. change getGUID() in order to return something unique in the jumpcloud LDAP installation, e.g.:

private String getGuid(SearchResult sr) throws NamingException{
return sr.getName().toString(); //you can also return a unique id analogously as the original script
}

3. change your filter:
private String ldapFilter = "(|(objectClass=organizationalUnit)(objectClass=person)(objectClass=posixGroup))";

4. change the username property:

//node.setUsername(getStringAttribute(sr, "sAMAccountName"));
node.setUsername(getStringAttribute(sr, "uid")); // set uid or any attribute you have identifying your username

5.  You may have to adapt the type of recovered objects

//} else if (objectClass.contains ("user")) {
} else if (objectClass.contains ("person")) {

In order to check your settings, I would recommend you using an external tool, e.g. ldapsearch.
For example:

ldapsearch -x -b "ou=Users,o=58b57552f9,dc=jumpcloud,dc=com" -D "uid=danna,ou=Users,o=58b57552f9,dc=jumpcloud,dc=com" -w "myPassword" -H ldap://ldap.jumpcloud.com:389 "(|(objectClass=organizationalUnit)(objectClass=person)(objectClass=group))"

Here you see the filter "(|(objectClass=organizationalUnit)(objectClass=person)(objectClass=group))" and the rest of the parameters. So you can change them until you get the list of all the users you need. When you find out the correct parameters, you can enter them to the script and it should work analogously as the external LDAP client.

As you see, this is more difficult to configure than the new 4.1.0 ldap.cf file. Anyhow, you need the correct values from your specific LDAP installation. In the 4.1.0 version you have "ldaptest" for testing the filter, the users, etc.

Regards,
Eduardo

Offline

#13 2022-04-20 08:52:46

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Gopisrinivasan wrote:

Hi Team,
Could you please confirm, whether we need to enter username and password to login, even though we have implement SSO authentication with LDAP.

Hi Gopi S,

in this case you should enter your LDAP username and password instead of your local reportserver username and passwords.

Regards,
Eduardo

Offline

#14 2022-04-20 10:20:24

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,

Thanks for the update.

As per our client requirement we need to implement SSO (Single Sign On). That means we need to login automatically with out entering username and password. Could you please confirm whether it is possible in Report server

Also Could you please confirm, is there any point of contact to schedule a call and have small discussion to meet our client requirement

Please confirm

Offline

#15 2022-04-21 08:16:17

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,

Could you please provide the update for above query

Offline

#16 2022-04-21 09:10:15

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

using LDAP you have to enter the LDAP username/password when logging into ReportServer.

If you need a SSO solution where you don't have to, you can take a look at CAS (https://www.apereo.org/projects/cas) or KeyCloak (https://www.keycloak.org/)

Also check here: https://forum.reportserver.net/viewtopic.php?id=1327
and https://forum.reportserver.net/viewtopi … 4036#p4036

Also, pls check the KeyCloak and CAS documentation for more information.

Regards,
Eduardo

Offline

#17 2022-05-04 06:56:10

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
As you mentioned before, we are looking for Report Server 4.1.0 version for Linux, but we could not able to find that, Since the link you have shared were we could get only Windows version
https://reportserver.net/de/download/

Please advise on this.

Thanks & Regards,
Gopi S

Offline

#18 2022-05-04 09:19:44

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
We are using Linux operating system with Report server 3.7 version and we want to upgrade to 4.1.0 version.
As per the link you have shared [https://reportserver.net/de/download/] we will get for windows not for Linux. How we can upgrade the version from 3.7 to 4.1.0 ?

It will be great, if you guide to do the same.

Thanks & Regards,
Gopi S

Offline

#19 2022-05-04 12:40:26

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
Could you please provide the update for the above query.

Thanks & Regards,
Gopi S

Offline

#20 2022-05-04 15:39:25

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

in https://reportserver.net/en/download/ you can find 1. binaries: for all platforms 2. installer packages: for windows/mac 3. docker images (for linux) , 4. virtual machines

so in your case, as you are upgrading reportserver, you should download 1. binaries and upgrade as explained here: https://reportserver.net/en/tutorials/upgrade-30/

Regards,
Eduardo

Offline

#21 2022-05-05 12:10:22

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
Thanks a lot for the update. Also Could you please confirm, is there any way to get the report or Details for the person who login to the Report server.

Thanks & Regards,
Gopi S

Offline

#22 2022-05-06 12:17:04

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

in the future, pls open new threads for unrelated issues.
There is currently no out-of-the-box way to do this , but you can use scripting for this.
Maybe this script helps:

import net.datenwerke.security.service.authenticator.*;
import net.datenwerke.security.service.usermanager.*;
import java.util.GregorianCalendar;

def uservice = GLOBALS.getRsService(UserManagerService.class);
def diff = 1000*60*60;
def now = new GregorianCalendar().getTimeInMillis();
GLOBALS.getRsService(AuthenticatorService.class).getLastRequests().collect({ key, value ->
uservice.getNodeById(key)?.getUsername() + " " + ((now-value)/1000/60) + " minutes ago\n"; 
}).join();

Regards,
Eduardo

Offline

#23 2022-05-06 15:06:18

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
We have following the Link [https://reportserver.net/en/tutorials/upgrade-30/] to upgrade 3.7 to 4.1.0 as per your advice.
1. we have downloaded the ReportServer 4.1.0.
2. Unzip and before copy and paste the file, we want to take the backup of the 3.7 files,
   But we could not see the structure like 4.1.0 in 3.7. Example [ ReportServer.html and a folder called ddl is not present in 3.7 version]

Please guide us, what we should do now.
we could see the below files in 3.7, but where as we could not see any of them in 4.1.0
apache2
apache-tomcat
apps
bncert-tool
img
java
licenses
manager-linux-x64.run
mariadb
reasme.txt
scripts
uninstall
uninstall.dat

Thanks & Regards,
Gopi S

Offline

#24 2022-05-09 07:56:43

eduardo
Administrator
Registered: 2016-11-01
Website

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Gopi S,

pls check under apache-tomcat, then webapps, then you should see your application. Most important is the db-backup, so also pls keep this on mind.

Regards,
Eduardo

Offline

#25 2022-05-13 06:41:37

Gopisrinivasan
Member
Registered: 2022-04-12

Re: Getting Exception when connecting LDAP Active directory from Groovy

Hi Eduardo,
Thanks for the update. I am able to find the folder and i have replace the files as mentioned in the document. After that i have reboot the server and start the apache tomcat server as well.

I am connecting Report server through browser. Issue is Home page is loading continuously and not getting user name and password screen. Please help to resolve this issue.

Thanks & Regards,
Gopi S

Offline

Board footer

Powered by FluxBB