2019.06 2020.06

Anbindung von LDAP

Beschreibung der Anbindung an externe Authentifizierungs- und Authorisierungssysteme.

LDAP

MyCoRe gestattet grundsätzlich die Anbindung des Lightweight Directory Access Protocol (LDAP) als Verzeichnisdienst an das Benutzersystem. Dies ermöglicht die Integration in Registrierungsprozesse der betreibenden Einrichtung.

LDAP Konfiguration per Tomcat Realm

Im einfachsten Fall wird die LDAP Anbindung direkt als Tomcat Realm innerhalb der server.xml im Konfigurationsverzeichnis des Tomcat Application Containers definiert. Dafür muss die folgende Konfiguration um die Institutions-spezifischen Parameter ergänzt werden:

1
2
3
4
5
6
7
8
<Realm className="org.apache.catalina.realm.JNDIRealm"
       connectionURL="ldaps://ldap..."
       userBase="o=..."
       userSubtree="true"
       userSearch="(&(objectClass=...)(cn={0})(groupMembership=cn=...,ou=...,o=...))"
       commonRole="submitter">
  ...
</Realm>

Zusätzlich ist es notwendig, in der realms.xml die Definition des Realms mit der id "servlet3" zu aktivieren und nach den eigenen Vorstellungen anzupassen. Dies umfasst insbesondere Parameter wie die passwordChangeURL und die Sektion, durch die Erstellung eines neuen Accounts konfiguriert wird (create).

LDAP Konfiguration mittels des CascadingAuthenticationServlets

Sofern LDAP in Kombination mit weiteren Authentifizierungs-Mechanismen verwendet werden soll (im folgenden Beispiel: lokale Nutzerverwaltung in Kombination mit LDAP-Nutzerverwaltung), kommt die Verwendung des MCRCascadingAuthenticationHandlers in Frage. Der MCRCascadingAuthenticationHandler ist zum aktuellen Zeitpunkt noch nicht Teil des MyCoRe Frameworks. Eine Integration ist zum späteren Zeitpunkt aber geplant.

Folgende Schritte sind grundsätzlich zu tun:

Konfigurationsbeispiel der mycore.properties

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
MCR.user2.CascadingLogin.Realms=local ldap
MCR.user2.CascadingLogin.ldap=java.package.pfad.zum.LDAPAuthenticationHandler

MCR.user2.LDAP.Realm=ldap
MCR.user2.LDAP.ProviderURL=ldaps://ldap2.uni-duisburg-essen.de
MCR.user2.LDAP.ReadTimeout=5000

# Base DN, uid of user on actual login will be used!
# We do not use any "global" credentials, just the user's own uid and password to connect
MCR.user2.LDAP.BaseDN=uid=%s,ou=people,dc=uni-duisburg-essen,dc=de

# Filter for user ID
MCR.user2.LDAP.UIDFilter=(uid=%s)

# Mapping from LDAP attribute to real name of user
MCR.user2.LDAP.Mapping.Name=cn

# Mapping from LDAP attribute to E-Mail address of user
MCR.user2.LDAP.Mapping.E-Mail=mail

# Default group membership (optional)
MCR.user2.LDAP.Mapping.Group.DefaultGroup=submitter

# Mapping of any attribute.value combination to group membership of user
# eduPersonScopedAffiliation may be faculty|staff|employee|student|alum|member|affiliate
# MCR.user2.LDAP.Mapping.Group.eduPersonScopedAffiliation.staff@uni-duisburg-essen.de=submitter

# Integrate an own realm.xml
MCR.user2.Realms.URI=resource:realms-duepublico.xml

Beispiel der realms.xml

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<realms local="local">

  <realm id="cascading" setable="false">
    <label xml:lang="de">Für Studierende, Mitarbeiter und alle anderen Nutzer von DuEPublico:</label>
    <label xml:lang="de">For students, staff and all other users of DuEPublico:</label>
    <login url="../authorization/login.xed" redirectParameter="url">
      <label xml:lang="de">Login mit der Unikennung der Universität Duisburg-Essen, oder mit einer lokalen DuEPublico Kennung</label>
      <label xml:lang="en">Login with credentials from University of Duisburg-Essen, or a local DuEPublico account</label>
    </login>
  </realm>

  <realm id="ldap">
    <label xml:lang="de">Für Studierende und Mitarbeiter der UDE:</label>
    <label xml:lang="en">For students and staff of UDE:</label>
    <login url="../authorization/login.xed" redirectParameter="url">
     <label xml:lang="de">Login mit der Unikennung der Universität Duisburg Essen</label>
      <label xml:lang="en">Login with credentials from University of Duisburg-Essen</label>
    </login>
  </realm>

  <realm id="local">
    <label xml:lang="de">Für sonstige registrierte Anwender:</label>
    <label xml:lang="en">For other registered users:</label>
    <login url="../authorization/login.xed" redirectParameter="url">
      <label xml:lang="de">Anmeldung mit lokaler DuEPublico Nutzerkennung</label>
      <label xml:lang="en">Login with local DuEPublico user account</label>
    </login>
    <passwordChangeURL>../authorization/change-password.xed?action=password</passwordChangeURL>
  </realm>

</realms>