Skip to content

Implement example ldap adapter methods with timeout

Peter Bolha requested to merge xbolha/STR-1397/implement_ldap_adapter into main

Description

Implementation of LDAP adapter base logic together with getPerunUser and getGroupByName methods. Inspired by python: https://gitlab.ics.muni.cz/perun/perun-proxyidp/perun-connector/-/blob/main/perun/connector/adapters/LdapAdapter.py?ref_type=heads

How to test

LDAP can be run from id-test. There's an example test configuration on id-test in folder: peter/test/perun-connector-java that can be run by the command: sudo ./gradlew :test --tests --rerun-tasks "perun.connector.LdapTest.testGetPerunUser"

Author's checklist

  • I have followed the contribution guidelines
  • This MR has been tested or does not change functionality
  • I have added relevant merge request dependencies (if this MR has any)
  • I have added the correct labels
  • I have assigned reviewers (if any are relevant)
  • I have edited the documentation (if the changes require it) or I have noted the need for the change if I do not have access to the documentation
  • I have marked all introduced BREAKING CHANGES or necessary DEPLOYMENT NOTES in the commit message(s)

Reviewer's checklist

  • This MR has been tested or does not change functionality
  • This MR has correct commit message format

Other information

Implementation stems from Python but ultimately has to be changed in some places. Normally, an LDAP connection can be autoconfigured from the application.yaml file. However, in a case where we need to rotate between several LDAP adapters, we have to create separate configurations and load them to the LdapContextSource for each adapter (this happens in LdapConnector). That's why the config structure differs from both Python and traditional Spring implementation.

There's also a new extension of generic reflection in AdaptersManager in getGenericClass to accommodate the conversion between boxed and primitive data types in reflection based on this thread on StackOverflow.

Related issues

re STR-1397

Merge request reports