Wicket Security Presentation

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    4 Favorites & 1 Group

    Wicket Security Presentation - Presentation Transcript

    1. Wicket Security Wasp & Swarm
    2. Introduction
      • Maurice Marrink
      • Topicus
        • Core
        • Healthcare
        • Education
        • Finance
      • Using Wicket since 2004
      • History
      • Wasp
      • Swarm
      • Examples
        • Simple setup
        • Custom actions
        • Secure models
      • Questions?
      Agenda
    3. History
      • Pre Wicket: Jaas
      • 2004 Wicket POC authentication only
      • 2005 Custom Wicket for authorization
      • 2006 Wicket: IAuthorizationStrategy
      • 2006 Wicket-Jaas internal project
      • 2007 Wasp and Swarm
    4. WASP
      • Wicket Abstract Security Platform
      • Action based
      • Authentication and Authorization
      • Flexible base
      • Support classes
      • Java 1.4
      • Wicket 1.3
    5. 1 Permission for instantiation or authorization? 2a Authorization permission? 3a Authenticated and or authorized? 3b Custom security checks. 3c Check model. 2b Authorization permission? 4a Authenticated and or authorized? 4b Custom security checks. 3c Wicket Wasp strategy ISecurity Check ISecureModel Security implemen-tation Custom security check 1 2a 2b 3a 3b 4a 4b
      • Implement ISecurePage
        • Instantiation + login redirect
      • Add ISecurityCheck
      • Or add ISecureModel
        • Or use an ISecureComponent
          • Authorization and or Authentication
    6. SWARM
      • Standard Wicket Authentication and Rights Management
      • Based on Wasp
      • ACL based
      • Session scope
      • Easy to use with dynamic roles
      • Jaas like security implementation
        • Subjects
        • Principals
        • Permissions
        • Actions
        • Policy files
    7. grant principal nl.example.Principal "basic" { permission ${ComponentPermission} "${myPackage}.SomePage", "inherit, render"; };
    8. Simple setup Example
      • Extend SwarmWebApplication
      • Create Principal(s)
      • Write policy files
    9. public class App extends SwarmWebApplication { public Class<HomePage> getHomePage(){ return HomePage.class; } public Class<LoginPage> getLoginPage(){ return LoginPage.class; } protected Object getHiveKey(){ return getServletContext().getContextPath(); } …
    10. protected void setUpHive(){ PolicyFileHiveFactory factory = new PolicyFileHiveFactory(); factory.setAlias(&quot;package&quot;, &quot;nl.example&quot;); try{ factory.addPolicyFile(getServletContext() .getResource(&quot;/WEB-INF/beheer.hive&quot;)); } ... HiveMind. registerHive(getHiveKey(), factory); }
    11. public class MyPrincipal implements Principal{ private String name; public MyPrincipal(String name){ this.name = name; } public String getName(){ return name; } public boolean implies(Subject subject){ return false; } … }
      • Design your Pages
      • Implement ISecurePage
      • Add security checks
      • Or add secure models
      • Or use secure component
    12.  
    13.  
    14. grant principal ${package}.MyPrincipal &quot;instelling.deelnemers&quot; { permission ${ComponentPermission} &quot;${package}.SearchPage&quot;, &quot;inherit, render&quot;; permission ${ComponentPermission} &quot;${package}.SearchPage&quot;, &quot;enable&quot;; permission ${ComponentPermission} &quot;${package}.detailPage&quot;, &quot;inherit, render&quot;; permission ${ComponentPermission} &quot;${package}.detailPage&quot;, &quot;enable&quot;; };
      • Design login page
      • Extend LoginContext
      • Populate Subject with Principals
    15. Wicket Security Example: Simple setup
    16. public boolean signIn(String username, String password, Domain domain){ LoginContext ctx = new MyLoginContext(username, password, domain); try{ ((WaspSession)Session.get()).login(ctx); return true; } catch (LoginException e){ error(e.getMessage()); } return false; }
    17. public Subject login() throws LoginException{ Account accnt = authenticate(username, password, domain); if (accnt != null){ clearFields(); return new MySubject(accnt); } clearFields(); throw new LoginException(“...”); }
    18. public class MySubject extends DefaultSubject{ public MySubject(Account account){ for (Role role : account.getRoles()){ for (MyPrincipal principal: role.getPrincipals()) addPrincipal(principal); } setReadOnly(); } }
    19. Custom actions Example
      • Should
      • Divide authorization in levels
      • Direct logic of custom security checks
      • Should not
      • Roles
      • User groups
    20. 1 Component and render or enable action 2a Same 3a Custom actions? Wicket Wasp strategy ISecurity Check Security implemen-tation 1 2a 3a
      • Create Actions
      • Register Actions
      • Use Actions in security check or secure model
    21.  
    22. register(Teacher.class, “teacher&quot;); register(Counselor.class, “counselor&quot;); register(Location.class, new SomeAction( “ location“, Teacher.class, Counselor.class)); register(School.class, new SomeAction( “ school“, Location.class)); public interface School extends WaspAction { // no explicit implementation required }
    23. public boolean isActionAuthorized(WaspAction action){ WaspAction combined = null, additional; ActionFactory factory = getActionFactory(); for (Class< ? extends WaspAction> actionClass : actions){ additional = factory.getAction(actionClass); combined = action.add(additional); if (wrapped.isActionAuthorized(combined)) return verify(additional); } return false; } protected abstract boolean verify(WaspAction action);
    24. protected boolean verify(WaspAction action){ if (action.implies(getAction(School.class))) return student.getSchool() .equals(getUser().getSchool()); if (action.implies(getAction(Location.class))) return student.takesClassesAt(getUser() .getLocations()); if(…….) ……… . return false; }
    25. Secure models Example
      • Can
      • In ListViews and other Repeaters
      • In DropDownChoices
      • Reuse of security without declaring it on every Component
      • Can NOT
      • As instantiation check
    26.  
    27. public interface ISecureModel extends IModel { public boolean isAuthorized(Component c, WaspAction a); public boolean isAuthenticated(Component c); } public interface SwarmModel extends ISecureModel { public String getSecurityId(Component c); }
      • Implement SwarmModel
      • Add DataPermission to policy file
    28. public final String getSecurityId(Component component){ return “foo”; } public boolean isAuthenticated(Component component){ return getStrategy().isModelAuthenticated(this, component); } public boolean isAuthorized(Component component, WaspAction action){ return getStrategy().isModelAuthorized(this, component, action); } protected List<Location> load(){ if (isAuthorized(null, getAction(Instelling.class))){ … } else if (isAuthorized(null, getAction(OrganisatieEenheid.class))){ … } }
    29. grant principal ${package}.MyPrincipal “something&quot; { permission ${DataPermission} “foo”, &quot;render, school&quot;; };
    30. More information: http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Security Questions?

    + mrmeanmrmean, 3 years ago

    custom

    8192 views, 4 favs, 1 embeds more stats

    Presentation given at the Amsterdam wicket meetup 2 more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 8192
      • 8190 on SlideShare
      • 2 from embeds
    • Comments 0
    • Favorites 4
    • Downloads 213
    Most viewed embeds
    • 2 views on http://orostuff.blogspot.com

    more

    All embeds
    • 2 views on http://orostuff.blogspot.com

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories

    Groups / Events