title: Security Realm for an application within WebSphere 7.0
body: <p>We are testing using security realms with our web application.  In test we will be going against Microsoft Active Directory.  Production will go against a custom realm.  I have the working great in Tomcat, but can't seem to get this working in WebSphere.  I have created a Security Domain (foo-ldap) within WebSphere that can connect to the AD.  For now I have applied foo-ldap to the server1 scope.  I'm not getting redirected to authenticate.faces when hitting /servlet/LoginServlet.</p>
  
  <p>Web.xml and Tomcat config included below.</p>
  
  <p>Tomcat config:</p>
  
  <pre><code>    &lt;Realm className="org.apache.catalina.realm.JNDIRealm"
          connectionURL="ldap://ActiveDirectorySrv:389"
          connectionName="CN=ldap user,CN=Users,DC=foo,DC=com"
          connectionPassword="Password1"
          referrals="follow"
          userBase="CN=Users,DC=foo,DC=com"
          userSearch="(&amp;amp;(objectCategory=user)(sAMAccountName={0}))"
          userSubtree="true"
          userRoleName="memberOf"
          roleBase="CN=Users,DC=foo,DC=com"  
          roleSubtree="true"  
          roleName="cn"  
          roleSearch="(member={0})"/&gt;
  </code></pre>
  
  <p>Web.xml</p>
  
  <pre><code>    &lt;security-constraint&gt;
          &lt;web-resource-collection&gt;
              &lt;web-resource-name&gt;Protected Area&lt;/web-resource-name&gt;
              &lt;url-pattern&gt;/servlet/LoginServlet&lt;/url-pattern&gt;
          &lt;/web-resource-collection&gt;
          &lt;auth-constraint&gt;
              &lt;role-name&gt;Developers&lt;/role-name&gt;
          &lt;/auth-constraint&gt;
      &lt;/security-constraint&gt;
  
      &lt;login-config&gt;
          &lt;auth-method&gt;FORM&lt;/auth-method&gt;
          &lt;form-login-config&gt;
              &lt;form-login-page&gt;/authenticate.faces&lt;/form-login-page&gt;
              &lt;form-error-page&gt;/loginFailed.faces&lt;/form-error-page&gt;
          &lt;/form-login-config&gt;
      &lt;/login-config&gt;
  
      &lt;security-role&gt;
          &lt;role-name&gt;Developers&lt;/role-name&gt;
      &lt;/security-role&gt;
  </code></pre>