Skip to content

Commit

Permalink
refactoring, documentation (Issue #174)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoika committed Feb 19, 2025
1 parent 868c45a commit 26eabbd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
26 changes: 24 additions & 2 deletions imixs-adapters-ldap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ The LDAP connection can either be configured as a JNDI Ressource with the name `

Die Search Configuration erfolgt über die `imixs.properties` Datei

| Variable | Description | Example |
|--------------------------------- |------------------------------------------------------|------------------------------------------------------------------- |
| Variable | Description | Example |
| -------------------------------- | ------------------------------------------------------ | ------------------------------------------------------------------- | ------------ | ------------- | -------------------- | ----------- |
| ldap.disable-jndi | Disable JNDI lookup | false |
| ldap.search-context | Search Context | DC=intern,DC=ib-vassen,DC=de |
| ldap.dn-search-filter | Suche nach UserID | (sAMAccountName=%u) |
Expand Down Expand Up @@ -134,6 +134,28 @@ The LDAPPlugin can be used in the system model to update a user profile when pro

The plugin runs on Profile Entities only. The plugin makes a ldap lookup and updates all items defined by he property ldap.user-attributes

## LDAP User Input Controller

As an alternative to the Marty UserInputController this project provides a generic `LDAPUserInputController` implementation. This CDI bean can be used as an alternative to the Marty UserInputController. It allows to search for names, even if there are no profiles created for them yet. The class is only used for the name search in user input fields from the [imixs-marty project](https://github.com/imixs/imixs-marty)! The controller can be declared as a replacement for the class `org.imixs.marty.profile.UserInputController` by adding the CDI Bean as an alternative defined in the `beans.xml`:

```xml
...
<alternatives>
<class>org.imixs.workflow.ldap.LDAPUserInputController</class>
</alternatives>
...
```

### Filter Phrase

The default filter phrase is defined by the following LDAP expression:

```
(& (|(objectClass=user)(objectClass=person)) (mail=*) (|(name=?*)(mail=?*)(cn=?*)(sn=?*)))")
```

This is filter phrase is useful for most cases. It can be overwritten by setting the property value `ldap.search-filter-phrase` in the ldap.properties file. See the section 'configuration' above.

## The LDAP Group Interceptor

The interceptor class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import java.util.List;
import java.util.logging.Logger;

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.imixs.marty.profile.ProfileService;
import org.imixs.marty.profile.UserInputController;
import org.imixs.workflow.ItemCollection;
Expand All @@ -37,7 +36,6 @@
import jakarta.ejb.EJB;
import jakarta.enterprise.context.SessionScoped;
import jakarta.enterprise.inject.Alternative;
import jakarta.inject.Inject;
import jakarta.inject.Named;

/**
Expand Down Expand Up @@ -77,10 +75,6 @@ public class LDAPUserInputController extends UserInputController {
@EJB
protected ProfileService profileService;

@Inject
@ConfigProperty(name = LDAPLookupService.LDAP_SEARCH_FILTER_PHRASE, defaultValue = "(& (|(objectClass=user)(objectClass=person)) (mail=*) (|(name=?*)(mail=?*)(cn=?*)(sn=?*)))")
String ldapSearchFilterPhrase;

private static Logger logger = Logger.getLogger(LDAPUserInputController.class.getName());

/**
Expand Down

0 comments on commit 26eabbd

Please sign in to comment.