Results 1 to 6 of 6

Thread: security in spring

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    jakarta
    Posts
    10

    Default security in spring

    hi,

    how do i able to get what commands that a user can access according to its roles ? i'm using jdbc authentication

    thanks ...
    ~goHAnZ

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    Take a look at the Petclinic Rich Client sample which shows how to integrate with Acegi Security.

    Once authentication has happened, you can access the list of granted authorities from anywhere in the application via:

    ((SecureContext) ContextHolder.getContext()).getAuthentication().ge tAuthorities()

  3. #3
    Join Date
    Sep 2004
    Location
    jakarta
    Posts
    10

    Default

    thanks for the answer ...

    ((SecureContext) ContextHolder.getContext()).getAuthentication().ge tAuthorities()

    i already do that. i make that call in the advisor, on method onWindowOpened ... but i get a null pointer exception ...
    i put it in the advisor, because i want to set enabled/disabled the toolbar/menubar for different roles.

    where should i make the call so it won't be null pointer again? =)

    thanks again ...
    ~goHAnZ

  4. #4
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    The Rich Client code that sets up the ContextHolder is org.springframework.richclient.security.SessionDet ails, as per the Petclinic sample. Although you are free to set it up however you like - it's just a ThreadLocal with Authentication populated via the Acegi Security net.sf.acegisecurity.provider.rcp package.

  5. #5
    Join Date
    Aug 2004
    Posts
    229

    Default

    What would be cool is a way to declaratively restrict access to UI commands/objects using Acegi and then have the UI automatically respond to these restrictions visually. The developer could choose from different response strategies: disable the command (buttons, menus, etc, will be grayed out), remove the command (it just won't show up), and others...
    Declarative security at the form level would be nice too (both for an entire form and also for individual properties/field).
    Hhhmmm.. not sure off the top of my head what form all this would take.

    - Andy

  6. #6
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    I agree with you re the command buttons, although I haven't had a chance to look at it for a while and the command structure and lifecycle were being refactored around the time security was added to Spring Rich, which is why it wasn't done back then. Things have settled down a lot since, so it's now just a question of getting time.

Similar Threads

  1. Spring MVC Web Framework versus Struts
    By biguniverse in forum Web Flow
    Replies: 27
    Last Post: Aug 29th, 2012, 03:57 AM
  2. Replies: 6
    Last Post: Sep 24th, 2006, 11:58 AM
  3. A Spring Class Loader?
    By azzoti in forum Architecture
    Replies: 8
    Last Post: May 7th, 2005, 04:02 AM
  4. Replies: 14
    Last Post: Feb 21st, 2005, 05:41 PM
  5. Role based security and Spring
    By spring04 in forum Security
    Replies: 1
    Last Post: Jan 19th, 2005, 03:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •