ISecureComponent on DropDownChoice

View: New views
2 Messages — Rating Filter:   Alert me  

ISecureComponent on DropDownChoice

by thedavid :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi

I have a class "SecureDropDownChoice" which implements ISecureComponent.
My hive looks like this:
grant principal org.apache.wicket.security.hive.authorization.SimplePrincipal "ROLE_OPERATOR"
{
        permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission "com.usermgmt.impl.pages.AdministrationPage" , "enable";
        permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission "com.usermgmt.impl.mgmt.SecureDropDownChoice" , "access";
};

The problem is that there are no checks on this component, and thus it's always rendered.

Afterwards I've overridden setupStrategyFactory() in my SwarmWebApplication by
setStrategyFactory(new SwarmStrategyFactory(MyClassHere,getHiveKey()));
like it is shown in the Swarm FAQ, but now I get following exception:

java.lang.IllegalArgumentException: Must provide an ActionFactory
        at org.apache.wicket.security.hive.config.PolicyFileHiveFactory.<init>(PolicyFileHiveFactory.java:131)
        at org.apache.wicket.security.hive.config.SwarmPolicyFileHiveFactory.<init>(SwarmPolicyFileHiveFactory.java:43)
        at com.usermgmt.impl.swarm.C2PSwarmWebApplication.setUpHive(C2PSwarmWebApplication.java:64)

I'm using swarm version 1.4-SNAPSHOT and wicket 1.4.1

Re: ISecureComponent on DropDownChoice

by thedavid :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, since I have figgered it out now by myself I'll post what I did wrong.

I simply forgot to set the SecurityCheck in my component's constructor like this:
setSecurityCheck(new ComponentSecurityCheck(this));

It's not necessary to "register" a custom ISecureComponent in the factory.