<?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>Fusioncube &#187; tomcat</title>
	<atom:link href="http://www.fusioncube.net/index.php/category/servers/tomcat/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fusioncube.net</link>
	<description>The online journey of a technophile, by Steve Brownlee</description>
	<lastBuildDate>Wed, 01 Feb 2012 04:17:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JBoss Role-Based Security</title>
		<link>http://www.fusioncube.net/index.php/jboss-role-based-security</link>
		<comments>http://www.fusioncube.net/index.php/jboss-role-based-security#comments</comments>
		<pubDate>Fri, 25 Feb 2005 20:14:06 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[jboss]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/?p=13</guid>
		<description><![CDATA[After days of searching different forums and tinkering around with settings myself, I discovered that the process for this is laughably simple, but the instructions exist nowhere in one place.  Until now...]]></description>
			<content:encoded><![CDATA[<p>Why is it that developers are so horrible at writing documentation? Here&#8217;s a task for you, search the JBoss documentation, even do a Google search, and try to find a clearly written, step-by-step tutorial on adding role-based security to a JBoss web app.</p>
<p>You can&#8217;t because, stunningly, it doesn&#8217;t exist&#8230;. until now. After days of searching different forums and tinkering around with settings myself, I discovered that the process is laughably simple, but the instructions exist nowhere (well, they exist, but good luck understanding them).</p>
<p>Here we go:</p>
<h3>Step 1 &#8211; Define secure resource for your application</h3>
<p>Edit the file <span style="color: rgb(0, 0, 153);">C:\{jboss install dir}\server\default\deploy\{your web app}\WEB-INF\web.xml</span></p>
<p>After all of the servlet-mapping sections (near the bottom of the file) you need to add security-contraint sections for each resource (file or directory) that you want secure. Here&#8217;s an example of how you would secure a directory named <strong>developer</strong>.</p>
<pre class="code"><code>&lt;security-constraint&gt;
	&lt;web-resource-collection&gt;
		&lt;web-resource-name&gt;developer&lt;/web-resource-name&gt;
		&lt;url-pattern&gt;/developer/*&lt;/url-pattern&gt;
	&lt;/web-resource-collection&gt;
	&lt;auth-constraint&gt;
		&lt;role-name&gt;developer&lt;/role-name&gt;
	&lt;/auth-constraint&gt;
	&lt;user-data-constraint&gt;
		&lt;transport-guarantee&gt;NONE&lt;/transport-guarantee&gt;
	&lt;/user-data-constraint&gt;
&lt;/security-constraint&gt;</code></pre>
<h3>Step 2 &#8211; Setting the authentication method</h3>
<p>Below that in the same file, specify what type of authentication you want to use for your security contraints. Check the JBoss documentation for the different types.</p>
<pre class="code"><code>&lt;login-config&gt;
	&lt;auth-method&gt;BASIC&lt;/auth-method&gt;
	&lt;realm-name&gt;My Application Security Zone&lt;/realm-name&gt;
&lt;/login-config&gt;</code></pre>
<h3>Step 3 &#8211; Defining the roles that have access</h3>
<p>Last step in this file is to define what roles will have access to this application&#8217;s security zones. You can take a quick peek at Step 7 to see how roles are set up.</p>
<pre class="code"><code>&lt;security-role&gt;
	&lt;description&gt;The role required to access restricted developer content&lt;/description&gt;
	&lt;role-name&gt;developer&lt;/role-name&gt;
&lt;/security-role&gt;

&lt;security-role&gt;
	&lt;description&gt;The role required to access restricted ColdFusion content &lt;/description&gt;
	&lt;role-name&gt;coldfusionadmin&lt;/role-name&gt;
&lt;/security-role&gt;</code></pre>
<h3>Step 4 &#8211; Applying your new policy</h3>
<p>Create/edit the file <span style="color: rgb(0, 0, 153);">C:\{jboss install dir}\server\default\deploy\{your web app}\WEB-INF\jboss-web.xml</span></p>
<p>Edit the file so that it contains the &lt;security-domain&gt; property. Here&#8217;s an example of what the file should look like&#8230;</p>
<pre class="code"><code>&lt;jboss-web&gt;
	&lt;context-root&gt;&lt;/context-root&gt;
	&lt;security-domain&gt;java:/jaas/{application policy name}</span>&lt;/security-domain&gt;
&lt;/jboss-web&gt;</code></pre>
<p>The application policy name can be anything you want.  Just pick a common-sense name. For example, if you&#8217;re app name is Widgets, just put that text in there.</p>
<h3>Step 5 &#8211; Telling JBoss about your policy</h3>
<p>Edit the file <span style="color: rgb(0, 0, 153);">C:\{jboss install dir}\server\default\conf\login-config</span> and add an application policy with the same name as what you put in {application policy name} in the previous step. Again, here&#8217;s an example&#8230;</p>
<pre class="code"><code>&lt;application-policy name ="{application policy name}"
	&lt;authentication&gt;
		&lt;login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required"&gt;
			&lt;module-option name="usersProperties"&gt;yourappnamehere-users.properties</span>&lt;/module-option&gt;
			&lt;module-option name="rolesProperties"&gt;yourappnamehere-roles.properties</span>&lt;/module-option&gt;
		&lt;/login-module&gt;
	&lt;/authentication&gt;
&lt;/application-policy&gt;</code></pre>
<h3>Step 6 &#8211; Creating users and roles files</h3>
<p>Now create the <span style="color: rgb(0, 0, 153);">WEB-INF\classes</span> directory under your web application if it doesn&#8217;t already exist.<br />
Create two files in the classes directory</p>
<ul>
<li>yourappnamehere-users.properties</li>
<li>yourappnamehere-roles.properties</li>
</ul>
<h3>Step 7 &#8211; Setting up your users</h3>
<p>In the users file, all you need to do is define a user and its password in the format <span style="color: rgb(0, 102, 0);">user=password</span> for as many as you need to create.</p>
<p>In the roles file, assign each user a role that you created in your web.xml file.<br />
<span style="color: rgb(0, 102, 0);">user=coldfusionadmin,developer</span><br />
<span style="color: rgb(0, 102, 0);">joe=developer</span><br />
<span style="color: rgb(0, 102, 0);">bob=coldfusionadmin</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/jboss-role-based-security/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>ColdFusion From Anywhere</title>
		<link>http://www.fusioncube.net/index.php/coldfusion-from-anywhere</link>
		<comments>http://www.fusioncube.net/index.php/coldfusion-from-anywhere#comments</comments>
		<pubDate>Wed, 16 Feb 2005 14:45:04 +0000</pubDate>
		<dc:creator>Steve Brownlee</dc:creator>
				<category><![CDATA[coldfusion]]></category>
		<category><![CDATA[tomcat]]></category>

		<guid isPermaLink="false">http://www.fusioncube.net/archives/8</guid>
		<description><![CDATA[Let&#8217;s say that your development, production and QA environments all want to play around with the ColdFusion administrator settings independantly of the actual application code. Development checks code into CVS, QA verifies it and a build is cut to production. What would happen if the administrator settings were different in each environment? Doesn&#8217;t sound like [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say that your development, production and QA environments all want to play around with the ColdFusion administrator settings independantly of the actual application code. Development checks code into CVS, QA verifies it and a build is cut to production. What would happen if the administrator settings were different in each environment? Doesn&#8217;t sound like a very stable, or safe, process.  One way around this is to have your ColdFusion root directory located completely outside your deployment path, perhaps even on a network drive.  Here&#8217;s how to start.</p>
<ol>
<li>When installing ColdFusion, choose the J2EE installation with the WAR file option</li>
<li>Once installation is complete, unpack (with any zip application) the WAR file to a temporary folder</li>
<li>Now create a folder on the same mounted drive as where you&#8217;ll be running ColdFusion (Jboss) from where all persistent data will be held</li>
<li>In your temporary folder, you&#8217;ll see a WEB-INF directory.  Move the <span style="font-weight: bold">cfusion </span>and <span style="font-weight: bold">cfclasses </span>directory from there to the folder you create in step 3</li>
<li>Now you can move the CFIDE and WEB-INF directories to the folder (or war file) of your web application</li>
</ol>
<p>Now you&#8217;ll be modifying the WEB-INF\web.xml file in several places. Here&#8217;s an example &#8211; your deployment directory path for your application is&#8230;  <span style="color: #000099"><br />
C:\jboss-4.0.1\server\default\deploy\myapp.war</span></p>
<p>Now let&#8217;s say that when production gets a new build, that they must delete the entire JBoss directory and deploy a completely new one from the build. You want to house your persistent files outside of that directory, such as&#8230;<br />
<span style="color: #000099">C:\PersistentData</span></p>
<p>In your <span style="color: #000099">myapp.war\WEB-INF\web.xml</span> file, you must change the value for all instances of the following properties to point to your persistent data folder.</p>
<ul>
<li><span style="color: #006600">cf.class.path</span></li>
<li><span style="color: #006600">cf.lib.path</span></li>
<li><span style="color: #006600">cfRootDir</span></li>
</ul>
<p>For this specific example, one value would be&#8230;</p>
<pre class="code"><code>&lt;context-param id="macromedia_context_89"&gt;
   &lt;param-name&gt;cf.lib.path&lt;/param-name&gt;
   &lt;param-value&gt;../../../../../../PersistentData/cfusion/lib&lt;/param-value&gt;
&lt;/context-param&gt;</code></pre>
<p>Once all are changed, ColdFusion &#8211; on startup &#8211; will now look in that location for all of its required libraries.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fusioncube.net/index.php/coldfusion-from-anywhere/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

