title: Ldap Basic Authentication with Glassfish
body: <p>My Ldap server, at this point, has this user:</p>
  
  <p><img src="https://i.stack.imgur.com/Txj52.png" alt="enter image description here"></p>
  
  <p>Password of MyLdap server is admin.</p>
  
  <p>My Glassfish console has this configuration:</p>
  
  <p><img src="https://i.stack.imgur.com/B8qVX.png" alt="enter image description here"></p>
  
  <p>My web.xml is this:</p>
  
  <pre><code>&lt;security-constraint&gt;
          &lt;display-name&gt;Private&lt;/display-name&gt;
          &lt;web-resource-collection&gt;
              &lt;web-resource-name&gt;secret&lt;/web-resource-name&gt;
              &lt;description/&gt;
              &lt;url-pattern&gt;/secured/*&lt;/url-pattern&gt;
              &lt;http-method&gt;GET&lt;/http-method&gt;
              &lt;http-method&gt;POST&lt;/http-method&gt;
              &lt;http-method&gt;HEAD&lt;/http-method&gt;
              &lt;http-method&gt;PUT&lt;/http-method&gt;
              &lt;http-method&gt;OPTIONS&lt;/http-method&gt;
              &lt;http-method&gt;TRACE&lt;/http-method&gt;
              &lt;http-method&gt;DELETE&lt;/http-method&gt;
          &lt;/web-resource-collection&gt;
          &lt;auth-constraint&gt;
              &lt;description/&gt;
              &lt;role-name&gt;secure&lt;/role-name&gt;
          &lt;/auth-constraint&gt;
      &lt;/security-constraint&gt;
  </code></pre>
  
  <p>My sun-web.xml has this:</p>
  
  <pre><code>&lt;security-role-mapping&gt;
      &lt;role-name&gt;secure&lt;/role-name&gt;
      &lt;group-name&gt;users&lt;/group-name&gt;
    &lt;/security-role-mapping&gt;
  </code></pre>
  
  <p>When i want to authenticate I introduce 1 as username (uid) and catia (corresponds to userPassword) to Password.</p>
  
  <p>I can´t login. What I´m doing wrong?</p>