Search Results

Search found 2 results on 1 pages for 'iauthorizationstrategy'.

Page 1/1 | 1 

  • In wicket, combine wicket:link with IAuthorizationStrategy

    - by seanizer
    Hi everybody. I use an IAuthorizationStrategy in wicket to limit access to certain pages. However, I also use html menus like this one: <div class="siteMenu"> <wicket:link> <a href="Page1.html" class="siteMenuLink"> <wicket:message key="pages.page1.title" /> </a> <a href="Page2.html" class="siteMenuLink"> <wicket:message key="pages.page2.title" /> </a> <a href="Page3.html" class="siteMenuLink"> <wicket:message key="pages.page3.title" /> </a> </wicket:link> </div> , that are automatically picked up and expanded using the wicket:link mechanism (like here: http://wicket.apache.org/examplenavomatic.html ). However, the IAuthorizationStrategy may not allow one or more of these target pages, so I may end up either with lots of links that lead to "permission denied" pages or lots of deactivated links (i.e. em tags or the like), neither of which is pretty. I could of course write an IComponentInstantiationListener that checks all BookmarkableLinks to see whether their target is accessible through the IAuthorizationStrategy and renders them invisible otherwise, but I wonder if there is an out-of-the-box solution to this problem. For clarification: I only use the isInstantiationAuthorized() method of IAuthorizationStrategy.

    Read the article

  • Wicket Authorization Using MetaDataKey

    - by JGirl
    I am trying to implement a simple authorization strategy for my Wicket application. I am implemented my own AuthorizationStrategy (extending IAuthorizationStrategy). http://old.nabble.com/Authorization-strategy-help-td18948597.html After reading the above link, I figured it makes more sense to use metadata-driven authorization than one using Annotations. So I have a simple RoleCheck class public class RoleCheck { private String privilege; public RoleCheck(String priv) { this.privilege = priv; } public void setPrivilege(String privilege) { this.privilege = privilege; } public String getPrivilege() { return privilege; } } I add it a component public static MetaDataKey priv = new MetaDataKey() {}; editLink.setMetaData(priv, new RoleCheck("Update")); And in my Authorization Strategy class, I try to get the metadata associated with the component public boolean isActionAuthorized(Component component, Action action) { if (action.equals(Component.RENDER)) { RoleCheck privCheck = (RoleCheck) component.getMetaData(EditControlToolBar.priv); if (privCheck != null) { ... } } However the getMetaData gives an error "Bound mismatch: The generic method getMetaData(MetaDataKey) of type Component is not applicable for the arguments (MetaDataKey). The inferred type RoleCheck is not a valid substitute for the bounded parameter " Any help would be appreciated. Thank you

    Read the article

1