title: Angular JS SPA using LDAP authentication
body: <p>I'm writing an <a href="https://angularjs.org/" rel="noreferrer">AngularJS</a> SPA application which calls Rest full web service. Back-end is being written on <code>JAX-RS</code>, deployed on <code>Tomcat 7</code>. I'm using <code>HTTPS, SSL</code> for transferring data from <code>SPA</code> to <code>JAX-RS</code></p>
  
  <p><strong>requirements</strong> <BR> </p>
  
  <ol>
  <li>I have to make LDAP authentication. (I will send username &amp; password to web service and it should make authentication)</li>
  <li>I have to do user's session management (because, when authenticated user sends request to web service, user doesn't have to authenticate again)</li>
  </ol>
  
  <p><strong>problems</strong> <BR></p>
  
  <ol>
  <li><p>I think there are two options for doing LDAP authentication: </p>
  
  <ul>
  <li>Make LDAP authentication using core java    <a href="http://docs.oracle.com/javase/jndi/tutorial/ldap/security/ldap.html" rel="noreferrer">http://docs.oracle.com/javase/jndi/tutorial/ldap/security/ldap.html</a></li>
  <li>Use Spring security (I'm not familiar with it and not sure if it's possible. I think I should send username &amp; password to rest service. Rest service will have spring security library injected and it'll be possible to use authentication functionality. Am I right?)</li>
  </ul></li>
  <li><p>Manage user sessions. Once user is authenticated, it should be saved somewhere, so that user can do operations until its logon is not expired. 
  How can I do it? </p></li>
  </ol>
  
  <p><BR> Which way should I choose? How should I make <strong>LDAP authenticating</strong> and <strong>session management</strong>? </p>
  
  <p><BR>Can anyone give any <strong>suggestion</strong> or <strong>example links</strong>?</p>