- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
LDAP-Gruppenmodul: DN ohne USER_LOGIN
Hallo Community,
ich habe folgenden use case, fรผr den ich keine Lรถsung finden kann:
Ich benutze das Modul FS-Personalisation mit Kerberos Login-Modul.
Jetzt will ich eine Seite nur fรผr Angehรถrige einer bestimmten Gruppe zugรคnglich machen.
Ich hรคtte gern das LDAP Gruppen-Modul benutzt, um die Gruppenzugehรถrigkeit aus dem Active Directory auszulesen, das auch in die Kerberos-Authentifizierung eingebunden ist.
Zur Konfiguration des LDAP Gruppen-Moduls muss ich unter anderem einen "Benutzer DN" der Form
"cn=$USER_LOGIN$,cn=Recipients,ou=E-SPIRIT,o=e-Spirit" angeben.
Jetzt ist es aber leider so, dass in der gegeben LDAP (Active Directory) Struktur der login Name nicht im Distinguished Name enthalten ist,
sondern als separates Attribute gehalten wird (userPrincipalName).
Bsp:
login name "test"
DN="cn=Hans Test,cn=Recipients,ou=E-SPIRIT,o=e-Spirit"
Wie kann ich trotzdem das Modul so konfigurieren, damit der betreffende Benutzer im LDAP gefunden wird?
Oder ist es bei gegebener LDAP Struktur einfach nicht mรถglich?
Danke fรผr einen Tipp...
Benny Kannengieรer
// re-lounge
- Labels:
-
Developers
- Tags:
- ldap
- personalisation
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Die XML-Datei sieht im Prinzip genau aus wie bei meiner funktionsfรคhigen Test-WebApp, die ich vor einigen Monaten erstellte. Sie kombiniert Kerberos mit LDAP als Fallback.
Hier die beiden Seiten der Test-WebApp. Wichtig ist der Parameter "loginPackage" bei ldap.jsp, der auf das LDAP-Loginpackage verweist und vermutlich das fsp:isNotAuthorized in index.jsp, weil ansonsten eben nur 401 dort angezeigt wรผrde, sofern man nicht mittels des Zusatzparameters bei fsp:authorize auf eine andere Seite automatisch umleitet, was in meinem Beispiel aber nicht erfolgt.
Datei index.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="FIRSTpersonalisation" prefix="fsp" %>
<html><body>
<fsp:isAuthorized groups="*">
<fsp:userInfo>
<p>logged in: <%= login %></p>
</fsp:userInfo>
<p>Attributes:<br/>
<fsp:userAttributes attributes="mail,displayName,telephoneNumber">
<%= attributename %>: <%= attributevalue %><br/>
</fsp:userAttributes>
<p>Groups:<br/>
<fsp:userGroups>
<%= groupname %>
</fsp:userGroups>
</p>
<form method="POST" action="<%= request.getContextPath() %>/do.logout">
<input type="hidden" name="redirect_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Logout" />
</form>
</fsp:isAuthorized>
<fsp:isNotAuthorized groups="*">
<p>not logged in</p>
<form method="GET" action="ldap.jsp">
<input type="hidden" name="login_ok_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Login" />
</form>
</fsp:isNotAuthorized>
</body></html>
<fsp:authorize />
Datei ldap.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="FIRSTpersonalisation" prefix="fsp" %>
<html><body>
<fsp:isAuthorized groups="*">
<fsp:userInfo>
<p>already logged in: <%= login %></p>
</fsp:userInfo>
<form method="POST" action="<%= request.getContextPath() %>/do.logout">
<input type="hidden" name="redirect_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Logout" />
</form>
</fsp:isAuthorized>
<fsp:isNotAuthorized groups="*">
<form method="POST" action="<%= request.getContextPath() %>/do.login">
<p>user: <input type="text" name="login" /></p>
<p>password: <input type="password" name="password" /></p>
<input type="hidden" name="loginPackage" value="LDAP" />
<input type="hidden" name="login_ok_url" value="<%= request.getContextPath() %>" />
<input type="hidden" name="wrong_login_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Login" />
</form>
</fsp:isNotAuthorized>
</body></html>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Die รผbliche Lรถsung bei uns fรผr den Fall ist, das Attribut-Modul zu nutzen, weil dies รผber den Modus "search_compare" eine Suche im LDAP-Baum bietet, die das LDAP-Groups-Modul nicht unterstรผtzt. Das nachfolgend konfigurierte LDAP-Groups-Modul verwendet dann das durch das Attribut-Modul gefunden Benutzerobjekt im LDAP um die Gruppen auszulesen. Insgesamt ergibt sich dann folgendes WEB-INF/firstpersonalisation.xml, wenn man im FirstSpirit-ServerManager die Konfiguration รผber die GUI zusammenstellt:
<FIRSTPERSONALISATION>
<LOGIN_PACKAGES>
<LOGIN_PACKAGE name="Kerberos" priority="0">
<LOGIN_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.login.KerberosLoginModule" name="Kerberos Login">
<PARAMETER_ENTRY name="userAgents" value=".*" />
<PARAMETER_ENTRY name="useFullPrincipal" value="false" />
</LOGIN_MODULE>
<ATTRIBUTES_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.attributes.LDAPAttributesModule" name="LDAP">
<PARAMETER_ENTRY name="bind_dn" value="CN=ldaprequest,CN=Users,DC=e-spirit,DC=de" />
<PARAMETER_ENTRY name="mode" value="search_compare" />
<PARAMETER_ENTRY name="host_url" value="ldap://ldap1.e-spirit.de" />
<PARAMETER_ENTRY name="search.base_dn" value="DC=e-spirit,DC=de" />
<PARAMETER_ENTRY name="bind_password" value="ldaprequest" />
<PARAMETER_ENTRY name="user_dn" value="not-used" />
<PARAMETER_ENTRY name="search.filter" value="(sAMAccountName=$USER_LOGIN$)" />
<PARAMETER_ENTRY name="attributes" value="mail,displayName,telephoneNumber" />
<PARAMETER_ENTRY name="ssl" value="false" />
</ATTRIBUTES_MODULE>
<GROUPS_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.groups.LDAPGroupsModule" name="LDAP Group">
<PARAMETER_ENTRY name="bind_dn" value="cn=ldaprequest,cn=users,dc=e-spirit,dc=de" />
<PARAMETER_ENTRY name="host_url" value="ldap://ldap1.e-spirit.de" />
<PARAMETER_ENTRY name="bind_password" value="ldaprequest" />
<PARAMETER_ENTRY name="user_dn" value="not-used" />
<PARAMETER_ENTRY name="ssl" value="false" />
<PARAMETER_ENTRY name="group_attribute" value="memberOf" />
</GROUPS_MODULE>
</LOGIN_PACKAGE>
</LOGIN_PACKAGES>
<GLOBAL_CONFIG_PARAMETERS>
<PARAMETER_ENTRY name="useDummyUser" value="false" />
<PARAMETER_ENTRY name="activateEveryoneGroup" value="true" />
<PARAMETER_ENTRY name="everyoneGroupString" value="" />
<PARAMETER_ENTRY name="ssoCookieName" value="" />
<PARAMETER_ENTRY name="ssoCookieLifetime" value="" />
<PARAMETER_ENTRY name="ssoCookieDomain" value="" />
<PARAMETER_ENTRY name="log4JFallbackConfigFile" value="" />
</GLOBAL_CONFIG_PARAMETERS>
</FIRSTPERSONALISATION>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hallo Herr Isenberg,
vielen Dank, funktioniert tipptopp!
Jetzt hรคtte ich noch eine Zusatzfrage:
Ich habe ein zweites Loginpackage konfiguriert (priority 1), fรผr den Fall, dass Kerberos nicht verfรผgbar ist.
Dann soll ein username/password Formular kommen (RequestParameter) und mit den Eingaben gegen das LDAP authentifiziert werden.
Ich habe das LDAP-Authentifizierungsmodul genauso wie das Attribut-Modul im Kerberos-Package konfiguriert (authentication "search-bind") - aber die Authentisierung schlรคgt fehl (401).
Im Konfigurationsdialog der Web-Komponente funktioniert s aber mit dem Testen" Button.
Habe ich noch etwas falsch konfiguriert? Es gibt einen Parameter "fsp-authProp.properties", dessen Zweck mit nicht klar ist.
Hier meine Konfiguration:
<FIRSTPERSONALISATION>
<LOGIN_PACKAGES>
<LOGIN_PACKAGE name="Kerberos" priority="0">
<LOGIN_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.login.KerberosLoginModule" name="Kerberos Login">
<PARAMETER_ENTRY name="userAgents" value=".*(Firefox|Iceweasel|Konqueror|MSIE|Opera|Safari|Shiretoko|Gecko).*" />
<PARAMETER_ENTRY name="useFullPrincipal" value="false" />
</LOGIN_MODULE>
<ATTRIBUTES_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.attributes.LDAPAttributesModule" name="LDAP">
<PARAMETER_ENTRY name="search.base_dn" value="OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="bind_dn" value="CN=Remotezugriff re-lounge allgemein,OU=Fremdfirmenzugriff,OU=Sonstige,OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="search.filter" value="(sAMAccountName=$USER_LOGIN$)" />
<PARAMETER_ENTRY name="bind_password" value="test" />
<PARAMETER_ENTRY name="host_url" value="ldap://srvdcfr1.e-spirit.intern,ldap://srvdcfr5.e-spirit.intern" />
<PARAMETER_ENTRY name="ssl" value="false" />
<PARAMETER_ENTRY name="attributes" value="cn, displayName, givenName, name, sn, telephoneNumber, department" />
<PARAMETER_ENTRY name="mode" value="search_compare" />
</ATTRIBUTES_MODULE>
<GROUPS_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.groups.LDAPGroupsModule" name="LDAP Group">
<PARAMETER_ENTRY name="group_attribute" value="memberOf" />
<PARAMETER_ENTRY name="bind_dn" value="CN=Remotezugriff re-lounge allgemein,OU=Fremdfirmenzugriff,OU=Sonstige,OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="bind_password" value="test" />
<PARAMETER_ENTRY name="host_url" value="ldap://srvdcfr1.e-spirit.intern,ldap://srvdcfr5.e-spirit.intern" />
<PARAMETER_ENTRY name="user_dn" value="not-used" />
<PARAMETER_ENTRY name="ssl" value="false" />
</GROUPS_MODULE>
</LOGIN_PACKAGE>
<LOGIN_PACKAGE name="LDAP username/password" priority="1">
<LOGIN_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.login.RequestParameterLoginModule" name="Request Parameter Login">
</LOGIN_MODULE>
<AUTHENTICATION_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.authentication.LDAPAuthenticationModule" name="LDAP">
<PARAMETER_ENTRY name="search.base_dn" value="OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="search.filter" value="(sAMAccountName=$USER_LOGIN$)" />
<PARAMETER_ENTRY name="bind_dn" value="CN=Remotezugriff re-lounge allgemein,OU=Fremdfirmenzugriff,OU=Sonstige,OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="allowEmptyPasswords" value="false" />
<PARAMETER_ENTRY name="bind_password" value="test" />
<PARAMETER_ENTRY name="authentication" value="search_bind" />
<PARAMETER_ENTRY name="host_url" value="ldap://srvdcfr1.e-spirit.intern,ldap://srvdcfr5.e-spirit.intern" />
<PARAMETER_ENTRY name="ssl" value="false" />
<PARAMETER_ENTRY name="user_dn" value="not-used" />
<PARAMETER_ENTRY name="propertyFile" value="/WEB-INF/fsp-authProp.properties" />
<PARAMETER_ENTRY name="createCookie" value="false" />
</AUTHENTICATION_MODULE>
<ATTRIBUTES_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.attributes.LDAPAttributesModule" name="LDAP">
<PARAMETER_ENTRY name="search.base_dn" value="OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="bind_dn" value="CN=Remotezugriff re-lounge allgemein,OU=Fremdfirmenzugriff,OU=Sonstige,OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="search.filter" value="(sAMAccountName=$USER_LOGIN$)" />
<PARAMETER_ENTRY name="bind_password" value="test" />
<PARAMETER_ENTRY name="host_url" value="ldap://srvdcfr1.e-spirit.intern,ldap://srvdcfr5.e-spirit.intern" />
<PARAMETER_ENTRY name="ssl" value="false" />
<PARAMETER_ENTRY name="attributes" value="cn, displayName, givenName, name, sn, telephoneNumber, department" />
<PARAMETER_ENTRY name="mode" value="search_compare" />
</ATTRIBUTES_MODULE>
<GROUPS_MODULE class="de.espirit.firstspirit.opt.personalisation.modules.groups.LDAPGroupsModule" name="LDAP Group">
<PARAMETER_ENTRY name="group_attribute" value="memberOf" />
<PARAMETER_ENTRY name="bind_dn" value="CN=Remotezugriff re-lounge allgemein,OU=Fremdfirmenzugriff,OU=Sonstige,OU=Abteilungen,DC=e-spirit,DC=intern" />
<PARAMETER_ENTRY name="bind_password" value="test" />
<PARAMETER_ENTRY name="host_url" value="ldap://srvdcfr1.e-spirit.intern,ldap://srvdcfr5.e-spirit.intern" />
<PARAMETER_ENTRY name="ssl" value="false" />
<PARAMETER_ENTRY name="user_dn" value="not-used" />
</GROUPS_MODULE>
</LOGIN_PACKAGE>
</LOGIN_PACKAGES>
<GLOBAL_CONFIG_PARAMETERS>
<PARAMETER_ENTRY name="useDummyUser" value="false" />
<PARAMETER_ENTRY name="activateEveryoneGroup" value="true" />
<PARAMETER_ENTRY name="everyoneGroupString" value="" />
<PARAMETER_ENTRY name="ssoCookieName" value="" />
<PARAMETER_ENTRY name="ssoCookieLifetime" value="" />
<PARAMETER_ENTRY name="ssoCookieDomain" value="" />
<PARAMETER_ENTRY name="log4JFallbackConfigFile" value="/WEB-INF/fsp-logging.conf" />
</GLOBAL_CONFIG_PARAMETERS>
</FIRSTPERSONALISATION>
Woran kรถnnte es liegen?
Danke und Gruร,
Benny Kannengieรer
// re-lounge
Attache die personalization.xml
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Die XML-Datei sieht im Prinzip genau aus wie bei meiner funktionsfรคhigen Test-WebApp, die ich vor einigen Monaten erstellte. Sie kombiniert Kerberos mit LDAP als Fallback.
Hier die beiden Seiten der Test-WebApp. Wichtig ist der Parameter "loginPackage" bei ldap.jsp, der auf das LDAP-Loginpackage verweist und vermutlich das fsp:isNotAuthorized in index.jsp, weil ansonsten eben nur 401 dort angezeigt wรผrde, sofern man nicht mittels des Zusatzparameters bei fsp:authorize auf eine andere Seite automatisch umleitet, was in meinem Beispiel aber nicht erfolgt.
Datei index.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="FIRSTpersonalisation" prefix="fsp" %>
<html><body>
<fsp:isAuthorized groups="*">
<fsp:userInfo>
<p>logged in: <%= login %></p>
</fsp:userInfo>
<p>Attributes:<br/>
<fsp:userAttributes attributes="mail,displayName,telephoneNumber">
<%= attributename %>: <%= attributevalue %><br/>
</fsp:userAttributes>
<p>Groups:<br/>
<fsp:userGroups>
<%= groupname %>
</fsp:userGroups>
</p>
<form method="POST" action="<%= request.getContextPath() %>/do.logout">
<input type="hidden" name="redirect_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Logout" />
</form>
</fsp:isAuthorized>
<fsp:isNotAuthorized groups="*">
<p>not logged in</p>
<form method="GET" action="ldap.jsp">
<input type="hidden" name="login_ok_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Login" />
</form>
</fsp:isNotAuthorized>
</body></html>
<fsp:authorize />
Datei ldap.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="FIRSTpersonalisation" prefix="fsp" %>
<html><body>
<fsp:isAuthorized groups="*">
<fsp:userInfo>
<p>already logged in: <%= login %></p>
</fsp:userInfo>
<form method="POST" action="<%= request.getContextPath() %>/do.logout">
<input type="hidden" name="redirect_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Logout" />
</form>
</fsp:isAuthorized>
<fsp:isNotAuthorized groups="*">
<form method="POST" action="<%= request.getContextPath() %>/do.login">
<p>user: <input type="text" name="login" /></p>
<p>password: <input type="password" name="password" /></p>
<input type="hidden" name="loginPackage" value="LDAP" />
<input type="hidden" name="login_ok_url" value="<%= request.getContextPath() %>" />
<input type="hidden" name="wrong_login_url" value="<%= request.getRequestURI() %>" />
<input type="submit" value="Login" />
</form>
</fsp:isNotAuthorized>
</body></html>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Der hidden Parameter "loginPackage" hat gefehlt...
Jetzt klappt alles.
Vielen Dank fรผr den Beispiel-Code!
Gruร,
Benny Kannengieรer
// re-lounge

