<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Johannes Neubauer&#039;s Technical Blog</title>
	<atom:link href="http://johannesneubauer.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://johannesneubauer.wordpress.com</link>
	<description>Some technical know how I&#039;d like to share</description>
	<lastBuildDate>Tue, 02 Feb 2010 13:38:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='johannesneubauer.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Johannes Neubauer&#039;s Technical Blog</title>
		<link>http://johannesneubauer.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://johannesneubauer.wordpress.com/osd.xml" title="Johannes Neubauer&#039;s Technical Blog" />
	<atom:link rel='hub' href='http://johannesneubauer.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Moving to http://www.kingsware.de</title>
		<link>http://johannesneubauer.wordpress.com/2010/02/02/moving-to-httpwww-kingsware-de/</link>
		<comments>http://johannesneubauer.wordpress.com/2010/02/02/moving-to-httpwww-kingsware-de/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 13:37:37 +0000</pubDate>
		<dc:creator>johannesneubauer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://johannesneubauer.wordpress.com/?p=127</guid>
		<description><![CDATA[This blog has moved to http://www.kingsware.de.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=127&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This blog has moved to <a href="http://www.kingsware.de">http://www.kingsware.de</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johannesneubauer.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johannesneubauer.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/johannesneubauer.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/johannesneubauer.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johannesneubauer.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johannesneubauer.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johannesneubauer.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johannesneubauer.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=127&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://johannesneubauer.wordpress.com/2010/02/02/moving-to-httpwww-kingsware-de/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/067cee1a86dbe57d6de692dd39c6791b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">johannesneubauer</media:title>
		</media:content>
	</item>
		<item>
		<title>Multiple one phase resources in jBoss-5.1.0.GA</title>
		<link>http://johannesneubauer.wordpress.com/2009/10/28/multiple-one-phase-resources-in-jboss-5-1-0-ga/</link>
		<comments>http://johannesneubauer.wordpress.com/2009/10/28/multiple-one-phase-resources-in-jboss-5-1-0-ga/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 22:19:04 +0000</pubDate>
		<dc:creator>johannesneubauer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://johannesneubauer.wordpress.com/?p=114</guid>
		<description><![CDATA[In jBoss-5.0.1.GA there was the configuration file ${JBOSS_HOME}/${SERVER_CONFIG}/conf/jbossjta-properties.xml. In order to enable distributed transactions for multiple local resources (non-XA) the following option had to be inserted into this file: In jBoss-5.1.0.GA this config file has been replaced by ${JBOSS_HOME}/${SERVER_CONFIG}/conf/jbossts-properties.xml. So you have to add the same line into the xml-element with name properties and attributes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=114&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In jBoss-5.0.1.GA there was the configuration file <code>${JBOSS_HOME}/${SERVER_CONFIG}/conf/jbossjta-properties.xml</code>. In order to enable distributed transactions for multiple local resources (non-XA) the following option had to be inserted into this file:</p>
<p><pre class="brush: xml;">
&lt;property name=&quot;com.arjuna.ats.jta.allowMultipleLastResources&quot; value=&quot;true&quot;/&gt;
</pre></p>
<p>In jBoss-5.1.0.GA this config file has been replaced by <code>${JBOSS_HOME}/${SERVER_CONFIG}/conf/jbossts-properties.xml</code>. So you have to add the same line into the xml-element with name <em>properties</em> and attributes <em>depends</em> with value &#8220;arjuna&#8221; and name with value &#8220;jta&#8221;:</p>
<p><pre class="brush: xml;">
&lt;properties  depends=&quot;arjuna&quot; name=&quot;jta&quot;&gt;
        &lt;property name=&quot;com.arjuna.ats.jta.allowMultipleLastResources&quot; value=&quot;true&quot;/&gt;
        &lt;!-- ... --&gt;
&lt;/properties&gt;
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johannesneubauer.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johannesneubauer.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/johannesneubauer.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/johannesneubauer.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johannesneubauer.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johannesneubauer.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johannesneubauer.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johannesneubauer.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=114&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://johannesneubauer.wordpress.com/2009/10/28/multiple-one-phase-resources-in-jboss-5-1-0-ga/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/067cee1a86dbe57d6de692dd39c6791b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">johannesneubauer</media:title>
		</media:content>
	</item>
		<item>
		<title>SVN branching &amp; merging</title>
		<link>http://johannesneubauer.wordpress.com/2009/09/14/svn-branching-merging/</link>
		<comments>http://johannesneubauer.wordpress.com/2009/09/14/svn-branching-merging/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 14:11:19 +0000</pubDate>
		<dc:creator>johannesneubauer</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[branch]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[reintegration]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[revision]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[trunk]]></category>

		<guid isPermaLink="false">http://johannesneubauer.wordpress.com/?p=95</guid>
		<description><![CDATA[This post describes some branch &#38; merge scenarios for subversion repositories.  For more info have a look at the svn book. Reintegrate a branch to trunk Check, where the branch started: $ pwd branch_xy/ $ svn log --verbose --stop-on-copy . ------------------------------------------------------------------------ r2664 &#124; bob &#124; 2009-09-08 10:32:03 +0200 (Di, 08. Sep 2009) &#124; 2 Zeilen [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=95&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post describes some branch &amp; merge scenarios for subversion repositories.  For more info have a look at the <a href="http://svnbook.red-bean.com/nightly/en/svn.branchmerge.advanced.html#svn.branchmerge.advanced.advancedsyntax">svn book</a>.<br />
<span id="more-95"></span></p>
<h2>Reintegrate a branch to trunk</h2>
<p>Check, where the branch started:</p>
<pre> $ pwd
 branch_xy/
 $  svn log --verbose --stop-on-copy .
 ------------------------------------------------------------------------
 r2664 | bob | 2009-09-08 10:32:03 +0200 (Di, 08. Sep 2009) | 2 Zeilen
 Geänderte Pfade:
    A /branches/branch_xy (von /trunk:2663)</pre>
<p>Clean up your working copy of the trunk:</p>
<pre>$ pwd
trunk/
$ svn status
$ svn up
Revision 2695.</pre>
<p>So no changes are in your working copy and the head is revision r2695. Now merge:</p>
<pre>$ pwd
trunk/
$ svn merge -r 2664:2695 https://repo.org/svn/myrepo/branches/branch_xy .
U ...
A ...
...</pre>
<p>Then check, build, test your merged working copy. Afterwards checkin your changes:</p>
<pre>$ pwd
trunk/
$ svn ci</pre>
<h2>Synchronize a branch with the trunk</h2>
<p>If this is the first sync command use the branch revision like in the chapter before. Otherwise use the revision of the last sync.</p>
<pre>$ pwd
branch_xy/
$ svn merge -r last_sync_or_branch_copy_rev:HEAD https://repo.org/svn/myrepo/trunk .</pre>
<p>Afterwards you have synched your branch with the trunk and can commit the changes to your branch. This way reintegration of the branch to the trunk will be easier.</p>
<h2>Reintegrate a Synchronized branch to the trunk</h2>
<pre>$ pwd
trunk/
$ svn merge -r last_sync:HEAD https://repo.org/svn/myrepo/branch_xy</pre>
<h2>Further thoughts</h2>
<p>You can always execute a merge command and check the changes with <code>svn diff</code>. If the result does not match your wishes you can revert your changes with <code>svn revert -R .</code>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johannesneubauer.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johannesneubauer.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/johannesneubauer.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/johannesneubauer.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johannesneubauer.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johannesneubauer.wordpress.com/95/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johannesneubauer.wordpress.com/95/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johannesneubauer.wordpress.com/95/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=95&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://johannesneubauer.wordpress.com/2009/09/14/svn-branching-merging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/067cee1a86dbe57d6de692dd39c6791b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">johannesneubauer</media:title>
		</media:content>
	</item>
		<item>
		<title>Preventing a bad color representation in acroread for LaTeX documents</title>
		<link>http://johannesneubauer.wordpress.com/2009/09/03/preventing-a-bad-color-representation-in-acroread-for-latex-documents/</link>
		<comments>http://johannesneubauer.wordpress.com/2009/09/03/preventing-a-bad-color-representation-in-acroread-for-latex-documents/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 09:20:59 +0000</pubDate>
		<dc:creator>johannesneubauer</dc:creator>
				<category><![CDATA[Knowledge]]></category>
		<category><![CDATA[acroread]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[rgb]]></category>
		<category><![CDATA[transparency]]></category>

		<guid isPermaLink="false">http://johannesneubauer.wordpress.com/?p=88</guid>
		<description><![CDATA[Using pdftex to generate a PDF document from LaTeX source shows up to look ugly in acroread due to color model and transparency settings. The following LaTeX commando hacks this behavior: \pdfpageattr {/Group &#60;&#60; /S /Transparency /I true /CS /DeviceRGB&#62;&#62;}<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=88&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Using pdftex to generate a PDF document from LaTeX source shows up to look ugly in acroread due to color model and transparency settings. The following LaTeX commando hacks this behavior:<code><br />
\pdfpageattr {/Group &lt;&lt; /S /Transparency /I true /CS /DeviceRGB&gt;&gt;}<br />
</code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johannesneubauer.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johannesneubauer.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/johannesneubauer.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/johannesneubauer.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johannesneubauer.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johannesneubauer.wordpress.com/88/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johannesneubauer.wordpress.com/88/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johannesneubauer.wordpress.com/88/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=88&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://johannesneubauer.wordpress.com/2009/09/03/preventing-a-bad-color-representation-in-acroread-for-latex-documents/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/067cee1a86dbe57d6de692dd39c6791b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">johannesneubauer</media:title>
		</media:content>
	</item>
		<item>
		<title>Using JAAS login modules from jBoss in Tomcat</title>
		<link>http://johannesneubauer.wordpress.com/2009/06/26/using-jaas-login-modules-from-jboss-in-tomcat/</link>
		<comments>http://johannesneubauer.wordpress.com/2009/06/26/using-jaas-login-modules-from-jboss-in-tomcat/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 13:28:59 +0000</pubDate>
		<dc:creator>johannesneubauer</dc:creator>
				<category><![CDATA[Knowledge]]></category>
		<category><![CDATA[Application Server]]></category>
		<category><![CDATA[ejb 3.0]]></category>
		<category><![CDATA[JAAS]]></category>
		<category><![CDATA[java ee]]></category>
		<category><![CDATA[jBoss]]></category>
		<category><![CDATA[login module]]></category>
		<category><![CDATA[principal]]></category>
		<category><![CDATA[realm]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[subject]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Web Application]]></category>

		<guid isPermaLink="false">http://johannesneubauer.wordpress.com/?p=71</guid>
		<description><![CDATA[jboss login modules differ from tomcat login modules, so some adjustments have to be done in a sub class of a jboss login module in order to use it in tomcat.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=71&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>
A jboss login module (like the <code>LdapExtLoginModule</code> in jbosssx.jar shipped with jboss-5.0.1.GA) returns a<br />
<code>Group</code> array with one <code>SimpleGroup</code> named <em>&#8220;Roles&#8221;</em> as its role set.<br />
The parent class <code>AbstractServerLoginModule</code> combines this with the <code>Principal</code><br />
object representing the user. So the set of principals consists of two entries acting as the<br />
user and his roles. These are added to the principals of the <code>Subject</code> instance, which<br />
has been given to the login module when <code>LoginModule#initialize(Subject, javax.security.auth.callback.CallbackHandler, java.util.Map, java.util.Map)</code><br />
is called.
</p>
<p><span id="more-71"></span></p>
<p>
The tomcat realm <code>JAASRealm</code> (provided by catalina.jar shipped with tomcat 6.0.20) has two<br />
input parameters depicting the user and role class names. After <code>LoginContext#login()</code><br />
was succesfully invoked (<code>LoginModule#login()</code> and <code>LoginModule#commit()</code> were successful<br />
for all login modules being <em>required</em>) the subject mentioned earlier is retrieved and a new principal<br />
is created from it. In this process the set of principals (<code>Subject#getPrincipals()</code>) will<br />
be iterated. The first principal in the set fullfilling the following condition is used as the<br />
user:
</p>
<pre>
userClassNames.contains(principal.getClass().getName())
</pre>
<p>
Afterwards, the list of other principals is compared with the group class name mentioned earlier.<br />
Matching principal objects are used to create the roles using the name of the principal, only. There<br />
is no recursive search in the groups. So the newly created principal gets only<br />
one role called &#8220;Roles&#8221; instead of the roles being held in the <code>SimpleGroup</code> &#8220;Roles&#8221;.
</p>
<p>
Therefore using such a login module in tomcat requires creating a sub class, which searches<br />
the <code>SimpleGroup</code> roles and adds them seperately to the role set. This way the login module<br />
can be used to authenticate against a LDAP server in tomcat using the <code>JAASRealm</code>.
</p>
<p>
Here is an example implementation of the respective method:
</p>
<p><pre class="brush: java;">
@Override
protected Group[] getRoleSets() throws LoginException {
	List&lt;Group&gt; groups = new LinkedList&lt;Group&gt;();
	Enumeration&lt;? extends Principal&gt; roles = super.getRoleSets()[0].members();
	while(roles.hasMoreElements()) {
		groups.add(new SimpleGroup(roles.nextElement().getName()));
	}
	return groups.toArray(new Group[0]);
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johannesneubauer.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johannesneubauer.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/johannesneubauer.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/johannesneubauer.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johannesneubauer.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johannesneubauer.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johannesneubauer.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johannesneubauer.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=71&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://johannesneubauer.wordpress.com/2009/06/26/using-jaas-login-modules-from-jboss-in-tomcat/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/067cee1a86dbe57d6de692dd39c6791b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">johannesneubauer</media:title>
		</media:content>
	</item>
		<item>
		<title>Standalone Tomcat with jBoss plus authentication against LDAP</title>
		<link>http://johannesneubauer.wordpress.com/2009/06/13/standalone-tomcat-with-jboss-plus-authentication-against-ldap/</link>
		<comments>http://johannesneubauer.wordpress.com/2009/06/13/standalone-tomcat-with-jboss-plus-authentication-against-ldap/#comments</comments>
		<pubDate>Sat, 13 Jun 2009 15:48:15 +0000</pubDate>
		<dc:creator>johannesneubauer</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Application Server]]></category>
		<category><![CDATA[Authentication]]></category>
		<category><![CDATA[EJB]]></category>
		<category><![CDATA[JAAS]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[jBoss]]></category>
		<category><![CDATA[JNDI]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[RMI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Web Application]]></category>

		<guid isPermaLink="false">http://johannesneubauer.wordpress.com/?p=18</guid>
		<description><![CDATA[Install and configure a standalone Tomcat authenticating against LDAP and passing credentials to a jBoss when calling EJBs through remote interfaces.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=18&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This tutorial desribes, how to install and configure a standalone Tomcat, so that a deployed webapp can authenticate against LDAP and connect to a jBoss passing the credentials in every call of an EJB via remote interface , so that the business application can authenticate against the same LDAP, too. The configuration of the jBoss seems to be a more common and better documented task and will be covered in another tutorial, which I will link here later, as soon as I have written it.</p>
<p><strong>WARNING: Please don&#8217;t use this solution in a productive system, but for testing purpose only. The custom LdapExtLoginModule presented here exposes the credentials of all online users to all classes using the same class loader! I will add a blog post, as I find a solution for production systems.</strong><br />
<span id="more-18"></span></p>
<p>The tutorial has been successfully tested with the following versions of third party libraries:</p>
<ul>
<li>Tomcat 6.0.20</li>
<li>jBoss 5.0.1.GA</li>
</ul>
<p>The following steps are sufficient advices  for the impatient reader, in order to run the tomcat standalone with a connection to jboss. A more detailed description about what is going on here can be found in <a href="http://johannesneubauer.wordpress.com/2009/06/26/using-jaas-login-modules-from-jboss-in-tomcat/">using JAAS login modules from jboss in tomcat</a>. Here are the instructions:</p>
<ul>
<li> download tomcat:</li>
</ul>
<dl>
<dd> <a title="http://www.internet.bs/apache.org/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz" rel="nofollow" href="http://www.internet.bs/apache.org/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz">http://www.internet.bs/apache.org/tomcat/tomcat-6/v6.0.20/bin/apache-tomcat-6.0.20.tar.gz</a> </dd>
</dl>
<ul>
<li> decompress the file</li>
<li> edit <code>$CATALINA_HOME/bin/catalina.sh</code>:</li>
</ul>
<pre>export JAVA_OPTS="$JAVA_OPTS -Djava.security.auth.login.config=$CATALINA_HOME/conf/jaas.config
    -Djava.naming.provider.url=localhost:1399"</pre>
<ul>
<li>We&#8217;re using JAAS for authentication. We declare two login modules. The <code>ClientLoginModule</code> builds the security context for EJB calls, so that the application server gets the credentials for authentication. The <code>LdapExtLoginModule</code> authenticates the user with LDAP and builds  the subject for Tomcat. In order to configure JAAS create/edit the file <code>$CATALINA_HOME/conf/jaas.config</code>:</li>
</ul>
<pre>someapp {
 // create security context for jboss
 org.jboss.security.ClientLoginModule required;
     multi-threaded="true";
 // Login module for tomcat
 org.someorg.security.LdapExtLoginModule required
     java.naming.factory.initial="com.sun.jndi.ldap.LdapCtxFactory"
     java.naming.security.authentication="simple"
     java.naming.provider.url="ldap://&lt;your_ldap_host&gt;:&lt;your_ldap_port&gt;"
     //We use anonymous authentication to our LDAP here
     bindDN=""
     bindCredential=""
     // Base DN, where we search our users
     baseCtxDN="ou=people,dc=someorg,dc=org"
     // Our users log in via uid
     baseFilter="(uid={0})"
     // Our roles are situated in the following subtree
     rolesCtxDN="ou=Roles,dc=someorg,dc=org"
     // A member of a group is identified/referenced by its full DN here
     roleFilter="(member={1})"
     roleAttributeID="cn"
     // We assume flat roles
     roleRecursion="-1";
};</pre>
<ul>
<li> edit <code>$CATALINA_HOME/conf/server.xml</code>:
<ul>
<li> comment out all existing <code>&lt;Realm&gt;</code>-tags</li>
<li> add the following block:</li>
</ul>
</li>
</ul>
<pre>&lt;Realm className="org.apache.catalina.realm.JAASRealm"
       appName="someapp"
       useContextClassLoader="false"
       userClassNames="org.jboss.security.SimplePrincipal"
       roleClassNames="org.jboss.security.SimpleGroup"
/&gt;</pre>
<ul>
<li>Above we used a class called <code>org.someorg.security.LdapExtLoginModule</code>. This class must be on the class path of tomcat and jboss (<code>$CATALINA_HOME/lib</code> and <code>$JBOSS_SERVER_CONFIG_HOME/lib</code>). Here is an implementation of the class:</li>
</ul>
<p><pre class="brush: java;">package org.someorg.security;
public class LdapExtLoginModule
        extends org.jboss.security.auth.spi.LdapExtLoginModule {
 private String credential;
 private Principal identity;
 private static Map&lt;String, Object&gt; credentials = new HashMap&lt;String, Object&gt;();

 public static Object getCredential(String username) {
   return credentials.get(username);
 }

 @Override
 protected Group[] getRoleSets() throws LoginException {
     List&lt;Group&gt; groups = new LinkedList&lt;Group&gt;();
     Enumeration&lt;? extends Principal&gt; roles = super.getRoleSets()[0].members();
     while(roles.hasMoreElements()) {
     groups.add(new SimpleGroup(roles.nextElement().getName()));
   }
   return groups.toArray(new Group[0]);
 }

 @Override
 @SuppressWarnings(&quot;unchecked&quot;)
 public boolean login() throws LoginException {
   // See if shared credentials exist
   if( super.login() == true ) {
     String[] info = getUsernameAndPassword();
     this.identity = new SimplePrincipal(info[0]);
     this.credential = info[1];
     return true;
   }
   return false;
 }

 @Override
 public boolean commit() throws LoginException {
   // SecurityAssociationActions.setPrincipalInfo(identity, credential);
   boolean success = super.commit();
   if(success) {
     credentials.put(identity.getName(), credential);
   }
   return success;
 }

 @Override
 public boolean logout() throws LoginException {
   credentials.remove(identity.getName());
 }
}
</pre></p>
<ul>
<li>We can load a session bean in a servlet like this (the login has to be done at least once per request, because a new request might run in another thread, so a call to a session bean would be done with the user anonymous):</li>
</ul>
<p><pre class="brush: java;">
String user = httpRequest.getRemoteUser();
String credential = (String)LdapExtLoginModule.getCredential(user);
Properties env = new Properties();
env.setProperty(Context.INITIAL_CONTEXT_FACTORY, &quot;org.jboss.security.jndi.JndiLoginInitialContextFactory&quot;);
env.setProperty(Context.SECURITY_PRINCIPAL, user);
env.setProperty(Context.SECURITY_CREDENTIALS, credential);
env.setProperty(&quot;java.naming.factory.url.pkgs&quot;,&quot;org.jboss.naming:org.jnp.interfaces&quot;);
InitialContext ctx = new InitialContext(env);
MySessionBean sb = (MySessionBean)ctx.lookup(&quot;myapp/MySessionBean/remote&quot;);
...
</pre></p>
<ul>
<li>In order to get everything running jbosssx.jar and jbossall-client.jar (part of the jboss package) has to be on the classpath. So get it and put it into the <code>$CATALINA_HOME/lib</code> folder.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/johannesneubauer.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/johannesneubauer.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/johannesneubauer.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/johannesneubauer.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/johannesneubauer.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/johannesneubauer.wordpress.com/18/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/johannesneubauer.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/johannesneubauer.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=johannesneubauer.wordpress.com&amp;blog=8134604&amp;post=18&amp;subd=johannesneubauer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://johannesneubauer.wordpress.com/2009/06/13/standalone-tomcat-with-jboss-plus-authentication-against-ldap/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/067cee1a86dbe57d6de692dd39c6791b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">johannesneubauer</media:title>
		</media:content>
	</item>
	</channel>
</rss>
