Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need is a Stateless Spring Security configuration in front of your JAX RS end points. I have addressed exact problem you are trying to solve but I don't have my own code to share..</p> <p>Here is one project which has done the exact thing you are asking, Some wise man has done it all for you ;)</p> <p><a href="https://github.com/philipsorst/angular-rest-springsecurity" rel="noreferrer">https://github.com/philipsorst/angular-rest-springsecurity</a></p> <p>What is the magic ?</p> <ol> <li>You have one unprotected URL which does the Authentication, and set the user roles as well..</li> <li>Then you return some kind of Token, put it some where in cache which will be expected on every subsequent call..</li> <li>Upon new request on other protected resources, you will check if the Token is present in your cache/session store ( you need some mechanism to keep track of valid tokens )</li> <li>If token is resent and valid, you do the programmatic Log-in in Spring Security which ensures that you can use all the Security features spring provides, ( Annotations, JSTL Tags etc.. ) !</li> <li>Once passed token validation you will get the logged in user details in your controllers ( aka JAX RS resources ) to deal with security further..</li> <li>If the token was not valid or not present , it would be trapped by failure end point which would return appropriate response ( 401 )</li> </ol> <p><strong>Refer Following Link To Understand How Stateless Spring Security is configured..,</strong> <a href="https://github.com/philipsorst/angular-rest-springsecurity/blob/master/src/main/resources/context.xml" rel="noreferrer">https://github.com/philipsorst/angular-rest-springsecurity/blob/master/src/main/resources/context.xml</a></p> <p><strong>See how a user is validated for the first time and a token is generated..</strong> <a href="https://github.com/philipsorst/angular-rest-springsecurity/blob/master/src/main/java/net/dontdrinkandroot/example/angularrestspringsecurity/rest/resources/UserResource.java" rel="noreferrer">https://github.com/philipsorst/angular-rest-springsecurity/blob/master/src/main/java/net/dontdrinkandroot/example/angularrestspringsecurity/rest/resources/UserResource.java</a></p> <p><strong>Here is the class where programmatic login is performed on every request after token check..</strong> <a href="https://github.com/philipsorst/angular-rest-springsecurity/blob/master/src/main/java/net/dontdrinkandroot/example/angularrestspringsecurity/rest/AuthenticationTokenProcessingFilter.java" rel="noreferrer">https://github.com/philipsorst/angular-rest-springsecurity/blob/master/src/main/java/net/dontdrinkandroot/example/angularrestspringsecurity/rest/AuthenticationTokenProcessingFilter.java</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload