<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Source Allies Blog &#187; Group Authorization</title>
	<atom:link href="http://blogs.sourceallies.com/tag/group-authorization/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.sourceallies.com</link>
	<description>Technical and process thinking from Source Allies employees</description>
	<lastBuildDate>Thu, 19 Aug 2010 18:35:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Spring LDAP Group Authorization Tip</title>
		<link>http://blogs.sourceallies.com/2009/10/spring-ldap-group-authorization-tip/</link>
		<comments>http://blogs.sourceallies.com/2009/10/spring-ldap-group-authorization-tip/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 01:51:30 +0000</pubDate>
		<dc:creator>Matt Vincent</dc:creator>
				<category><![CDATA[Infrastructure]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Granted Authorities]]></category>
		<category><![CDATA[Group Authorization]]></category>
		<category><![CDATA[Spring LDAP]]></category>
		<category><![CDATA[Spring Security]]></category>

		<guid isPermaLink="false">http://blogs.sourceallies.com/?p=271</guid>
		<description><![CDATA[The folks at Spring have made it extremely easy to allow your application authenticate and authorize users with Spring LDAP.  This blog entry explains how to check your directory structure and use some sparsely documented Spring LDAP parameters ({0} and {1}) to get everything working. 
In your Spring Security configuration, pointing to your directory [...]]]></description>
			<content:encoded><![CDATA[<p>The folks at Spring have made it extremely easy to allow your application authenticate and authorize users with <a href="http://www.springsource.org/ldap">Spring LDAP</a>.  This blog entry explains how to check your directory structure and use some sparsely documented Spring LDAP parameters ({0} and {1}) to get everything working. </p>
<p>In your <a href="http://static.springsource.org/spring-security/site/">Spring Security</a> configuration, pointing to your directory is straight forward:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"> <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ldap-server</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;ldapServer&quot;</span> <span style="color: #000066;">url</span>=<span style="color: #ff0000;">&quot;ldap://dir.yourdomain.com:389/&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>But in configuring the ldap-authentication-provider, you need to know a few things about your directory of course!  We recommend using <a href="http://directory.apache.org/studio/">Apache Directory Studio</a> to browse your directory &#8211; it&#8217;s a fantastic application.</p>
<p>If you&#8217;re more of a command-line person, just use <a href="http://docs.sun.com/source/816-6400-10/lsearch.html">ldapsearch</a> (example below):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapsearch <span style="color: #660033;">-H</span> ldap:<span style="color: #000000; font-weight: bold;">//</span>dir.yourdomain.com:<span style="color: #000000;">389</span> <span style="color: #660033;">-ZZ</span> <span style="color: #660033;">-x</span> 
<span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=AdminUser,dc=yourdomain,dc=com&quot;</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-b</span> <span style="color: #ff0000;">&quot;cn=users,ou=groups,dc=yourdomain,dc=com&quot;</span> 
<span style="color: #660033;">-s</span> base <span style="color: #660033;">-a</span> always <span style="color: #ff0000;">&quot;(objectClass=*)&quot;</span> <span style="color: #ff0000;">&quot;*&quot;</span></pre></div></div>

<p>Once connected to your directory, you&#8217;ll need to figure out how your groups are configured.  Specifically, you&#8217;ll want to know if your configuration looks like </p>
<p>Example A:</p>
<ul>
<li> dc=yourdomain,dc=com</li>
<ul>
<li>ou=groups</li>
<ul>
<li>cn=users</li>
<ul>
<li><strong>memberUid=USERNAME</strong></li>
</ul>
</ul>
</ul>
</ul>
<p>or Example B:</p>
<ul>
<li> dc=yourdomain,dc=com</li>
<ul>
<li>ou=groups</li>
<ul>
<li>cn=users</li>
<ul>
<li> <strong>memberUid=uid= USERNAME,ou=people,dc= yourdomain,dc=com</strong></li>
</ul>
</ul>
</ul>
</ul>
<p>If it&#8217;s like Example A, you&#8217;ll want your config like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ldap-authentication-provider</span> <span style="color: #000066;">server-ref</span>=<span style="color: #ff0000;">&quot;ldapServer&quot;</span>  </span>
<span style="color: #009900;">	<span style="color: #000066;">user-search-base</span>=<span style="color: #ff0000;">&quot;ou=people,dc=yourdomain,dc=com&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">user-search-filter</span>=<span style="color: #ff0000;">&quot;(uid={0})&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">group-role-attribute</span>=<span style="color: #ff0000;">&quot;cn&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">group-search-base</span>=<span style="color: #ff0000;">&quot;ou=groups,dc=yourdomain,dc=com&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">group-search-filter</span>=<span style="color: #ff0000;">&quot;(memberUid={1})&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">role-prefix</span>=<span style="color: #ff0000;">&quot;ROLE_&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>otherwise, you&#8217;ll want this config:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ldap-authentication-provider</span> <span style="color: #000066;">server-ref</span>=<span style="color: #ff0000;">&quot;ldapServer&quot;</span>  </span>
<span style="color: #009900;">	<span style="color: #000066;">user-search-base</span>=<span style="color: #ff0000;">&quot;ou=people,dc=yourdomain,dc=com&quot;</span> </span>
<span style="color: #009900;">	<span style="color: #000066;">user-search-filter</span>=<span style="color: #ff0000;">&quot;(uid={0})&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">group-role-attribute</span>=<span style="color: #ff0000;">&quot;cn&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">group-search-base</span>=<span style="color: #ff0000;">&quot;ou=groups,dc=yourdomain,dc=com&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">group-search-filter</span>=<span style="color: #ff0000;">&quot;(memberUid={0})&quot;</span></span>
<span style="color: #009900;">	<span style="color: #000066;">role-prefix</span>=<span style="color: #ff0000;">&quot;ROLE_&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

<p>Note the difference in the <em>group-search-filter</em>:</p>
<ul>
<li><strong>{0}</strong> contains the username with the entire ldap base. </li>
<li><strong>{1}</strong> only contains username. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blogs.sourceallies.com/2009/10/spring-ldap-group-authorization-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
