Spring Security Database Schema – Whitepaper and Examples

March 31st, 2009 | by richfreedman |

Since I’ve gotten a lot of requests for the white paper and examples for Spring Security, I’m posting them here so that anyone who is interested can download them, rather than my sending them out one request at a time:

Whitepaper (PDF)

Examples (ZIP)


Chariot Solutions

Thanks go out to my employer, Chariot Solutions, for whom these were written, for allowing me to post them here.

  1. 8 Responses to “Spring Security Database Schema – Whitepaper and Examples”

  2. By nyuby on May 26, 2009 | Reply

    Thanks, one week i looking for something like this, it’s realy learn me, ..

  3. By nyuby on May 26, 2009 | Reply

    Hii, could i request some question, i have try to run your sample code and success, but i can’t still understand, how can authenticationManager inspect and load the username and password form database ? I don’t see anything about some query declaration there, Could you give me a explanation, i’m sory,, i’m very newbie in this context, and your sample code is very eazy for beginner, thanks a lot..

  4. By richfreedman on Jun 6, 2009 | Reply

    nyuby – my example was not meant to be a comprehensive tutorial on spring security, rather it was meant to show how you can use spring security to implement true role-based security, rather than the default approach.

    Generally, you don’t “load the username and password” yourself, you let the AuthenticationManger do it for you, as in this example – it’s configured in the Spring configuration.

    If you want to add additional info to the user, you have to implement AuthenticationManager.

    If all you want is to be able to get the user’s name, you can use
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    and then work from there – see the javadocs.

    If you just want to display the user’s name in a JSP, you can use
    <security:authentication property="principal.username" />

  5. By nyuby on Jun 21, 2009 | Reply

    Thanks, very help full for me…

  6. By Kamal Govindraj on Mar 2, 2010 | Reply

    Thank you for sharing this. It is really useful.

  7. By Cesar on Mar 19, 2010 | Reply

    hi

    Thanks to this tutorial, I implemented this solution in my system ;)

    I found a little “problem”, if one group has no permissions associated, the user in this group cannot login. You also have this problem ?

  8. By richfreedman on Mar 19, 2010 | Reply

    I’ve never run into a scenario where it makes sense for someone to have no permissions, yet be able to log in. What’s the point?

  1. 1 Trackback(s)

  2. Sep 6, 2009: Grey-Bearded Geek » Blog Archive » Spring Security Database Schema

Post a Comment