You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Janani Sundarrajan <js...@percipenz.com> on 2010/04/07 23:23:05 UTC

Wicket Authorization (Using MetaDataKey)

Hello,

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

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket Authorization (Using MetaDataKey)

Posted by Janani Sundarrajan <js...@percipenz.com>.
I will do that. Thank you.

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Wednesday, April 07, 2010 4:55 PM
To: users@wicket.apache.org
Subject: Re: Wicket Authorization (Using MetaDataKey)

well, there are plenty of uses of this in our code, have a look there

-igor

On Wed, Apr 7, 2010 at 2:51 PM, Janani Sundarrajan
<js...@percipenz.com> wrote:
> Doesn't seem to work either!
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Wednesday, April 07, 2010 4:48 PM
> To: users@wicket.apache.org
> Subject: Re: Wicket Authorization (Using MetaDataKey)
>
> public static MetaDataKey<RoleCheck> priv = new
> MetaDataKey<RoleCheck>(){};
>
> -igor
>
> On Wed, Apr 7, 2010 at 2:23 PM, Janani Sundarrajan
> <js...@percipenz.com> wrote:
>> Hello,
>>
>> 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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket Authorization (Using MetaDataKey)

Posted by Igor Vaynberg <ig...@gmail.com>.
well, there are plenty of uses of this in our code, have a look there

-igor

On Wed, Apr 7, 2010 at 2:51 PM, Janani Sundarrajan
<js...@percipenz.com> wrote:
> Doesn't seem to work either!
>
> -----Original Message-----
> From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com]
> Sent: Wednesday, April 07, 2010 4:48 PM
> To: users@wicket.apache.org
> Subject: Re: Wicket Authorization (Using MetaDataKey)
>
> public static MetaDataKey<RoleCheck> priv = new
> MetaDataKey<RoleCheck>(){};
>
> -igor
>
> On Wed, Apr 7, 2010 at 2:23 PM, Janani Sundarrajan
> <js...@percipenz.com> wrote:
>> Hello,
>>
>> 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
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Wicket Authorization (Using MetaDataKey)

Posted by Janani Sundarrajan <js...@percipenz.com>.
Doesn't seem to work either! 

-----Original Message-----
From: Igor Vaynberg [mailto:igor.vaynberg@gmail.com] 
Sent: Wednesday, April 07, 2010 4:48 PM
To: users@wicket.apache.org
Subject: Re: Wicket Authorization (Using MetaDataKey)

public static MetaDataKey<RoleCheck> priv = new
MetaDataKey<RoleCheck>(){};

-igor

On Wed, Apr 7, 2010 at 2:23 PM, Janani Sundarrajan
<js...@percipenz.com> wrote:
> Hello,
>
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Wicket Authorization (Using MetaDataKey)

Posted by Igor Vaynberg <ig...@gmail.com>.
public static MetaDataKey<RoleCheck> priv = new MetaDataKey<RoleCheck>(){};

-igor

On Wed, Apr 7, 2010 at 2:23 PM, Janani Sundarrajan
<js...@percipenz.com> wrote:
> Hello,
>
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org