Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring Security 3.2 Token Authentication
    primarykey
    data
    text
    <p>I know this has been asked already, but I am not able to get it to work. Here is what I would like to get accomplished:</p> <p>I am using Spring Security 3.2 to secure a REST-like service. No server side sessions. I am not using basic auth, because that would mean that I need to store the user's password in a cookie on client side. Otherwise the user would need to login with each page refresh/ change. Storing a token is I guess the lesser evil.</p> <ol> <li>A web client (browser, mobile app) calls a REST-like URL to login "/login" with username and password</li> <li>The server authenticates the user and sends a token back to the client</li> <li>The client stores the token and adds it to the http request header with each api call</li> <li>The server checks the validity of the token and sends a response accordingly</li> </ol> <p>I did not even look at the token generation part yet. I know it is backwards, but I wanted to get the token validation part implemented first.</p> <p>I am trying to get this accomplished by using a custom filer (implementation of AbstractAuthenticationProcessingFilter), however I seem to have the wrong idea about it. </p> <p>Defining it like this:</p> <pre><code>public TokenAuthenticationFilter() { super("/"); } </code></pre> <p>will only trigger the filter for this exact URL. I am sticking to some sample implementation, where it calls AbstractAuthenticationProcessingFilter#requiresAuthentication which does not accept wildcards. I can of course alter that behavior, but this somehow makes me think that I am on the wrong path.</p> <p>I also started implementing a custom AuthenticationProvider. Maybe that is the right thing? Can someone give me a push into the right direction?</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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