You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Alexander Fishchuk <al...@ulti.kiev.ua> on 2004/04/19 15:13:18 UTC

Component-level authorization

Hi guys
has anyone implemented a kind of component-level validation (authorization)
with Tapestry?

I need to show/hide arbitrary page components based on user's permissions
Permissions are instance-level not a class level...

any advice how to implement it would be appreciated

thanks in advance
Alex


RE: Component-level authorization

Posted by Petter Måhlén <pe...@elevance.se>.
I can see what you mean about making it declarative, but from my
perspective, the .html and .page (or .jwc) files are all equally much part
of the UI, meaning that putting it into the page specification means you
have security code in the UI as well. But I guess that in any case, if you
want to modify the UI based on security considerations, you will have some
kind of security code there..

Anyway, HTML code hidden by a 'false' Conditional is not seen by the client,
so there is no security problem there, even though there may be a question
of what kind of architectural model you prefer.

Concerning putting roles and things into the page specification, I would say
that's not a good idea. You don't want to have to change page/component
specifications all over the place when you add a new role or delete an old
one, or change so that the administrator group should be allowed to see a
kind of component they were not allowed before. I would do the mapping of
component access to roles/users in some separate place, based on stuff put
into a separate configuration file or more likely a set of database tables
that I can expose to system administrators via a UI.

/ Petter
 
> -----Original Message-----
> From: Alexander Fishchuk [mailto:al@ulti.kiev.ua] 
> Sent: den 19 april 2004 15:55
> To: Tapestry users
> Subject: RE: Component-level authorization
> 
> 
> Peter
> thanks for the advice... but I want it to be more 
> declarative... and I don't
> want to embed security code into UI implementation ;-)
> 
> 
> I'm thinkking of the scenario where I'd say in page 
> specification a list of
> Roles, User Names and Required Permissions for
> the component to be visible to User and use a kind of 
> Interceptor to check
> permissions on each IRender.render(writer, cycle)
> 
> I'm curious if anybody try to use any AOP framework with Tapestry (for
> example Springframework AOP) to archive such a behavior?
> 
> Alex
> 
> -----Original Message-----
> From: Petter Måhlén [mailto:petter.mahlen@elevance.se]
> Sent: Monday, April 19, 2004 16:39
> To: 'Tapestry users'
> Subject: RE: Component-level authorization
> 
> 
> I haven't done this, but maybe something like this in 
> Component.html would
> work:
> 
> <span jwcid="@Conditional"
> condition="ognl:visit.accessAuthorized(someComponentIdentifier)">
> ..actual component html..
> </span>
> 
> Or, if the Visit object for some reason isn't the right place 
> for it, you
> can have some kind of sub-class to BasePage that has the 
> ability to check if
> the current user is authorised to access a component, and 
> change it to:
> 
> <span jwcid="@Conditional"
> condition="ognl:page.accessAuthorized(someComponentIdentifier)">
> 
> If, by instance-level, you mean that Carl can access a User 
> component with
> id 1, but not with id 2, then the condition could be:
> 
> <span jwcid="@Conditional" 
> condition="ognl:visit.accessAuthorized('User',
> id)">
> 
> and your User.java would need a getId() method. To make it 
> more generic,
> maybe you could do something like:
> 
> <span jwcid="@Conditional" 
> condition="ognl:visit.accessAuthorized(typeId,
> instanceId)">
> or
> <span jwcid="@Conditional" 
> condition="ognl:visit.accessAuthorized(this)">
> 
> and provide getTypeId() and getInstanceId() methods in your 
> components or
> make the authorisation checking method take a component instance. The
> options are endless, which is the blessing of Tapestry - and 
> curse when you
> don't know where to begin ;).
> 
> / Petter
> 
> > -----Original Message-----
> > From: Alexander Fishchuk [mailto:al@ulti.kiev.ua]
> > Sent: den 19 april 2004 15:13
> > To: tapestry-user@jakarta.apache.org
> > Subject: Component-level authorization
> >
> >
> > Hi guys
> > has anyone implemented a kind of component-level validation
> > (authorization)
> > with Tapestry?
> >
> > I need to show/hide arbitrary page components based on user's
> > permissions
> > Permissions are instance-level not a class level...
> >
> > any advice how to implement it would be appreciated
> >
> > thanks in advance
> > Alex
> >
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Component-level authorization

Posted by Alexander Fishchuk <al...@ulti.kiev.ua>.
Peter
thanks for the advice... but I want it to be more declarative... and I don't
want to embed security code into UI implementation ;-)


I'm thinkking of the scenario where I'd say in page specification a list of
Roles, User Names and Required Permissions for
the component to be visible to User and use a kind of Interceptor to check
permissions on each IRender.render(writer, cycle)

I'm curious if anybody try to use any AOP framework with Tapestry (for
example Springframework AOP) to archive such a behavior?

Alex

-----Original Message-----
From: Petter Måhlén [mailto:petter.mahlen@elevance.se]
Sent: Monday, April 19, 2004 16:39
To: 'Tapestry users'
Subject: RE: Component-level authorization


I haven't done this, but maybe something like this in Component.html would
work:

<span jwcid="@Conditional"
condition="ognl:visit.accessAuthorized(someComponentIdentifier)">
..actual component html..
</span>

Or, if the Visit object for some reason isn't the right place for it, you
can have some kind of sub-class to BasePage that has the ability to check if
the current user is authorised to access a component, and change it to:

<span jwcid="@Conditional"
condition="ognl:page.accessAuthorized(someComponentIdentifier)">

If, by instance-level, you mean that Carl can access a User component with
id 1, but not with id 2, then the condition could be:

<span jwcid="@Conditional" condition="ognl:visit.accessAuthorized('User',
id)">

and your User.java would need a getId() method. To make it more generic,
maybe you could do something like:

<span jwcid="@Conditional" condition="ognl:visit.accessAuthorized(typeId,
instanceId)">
or
<span jwcid="@Conditional" condition="ognl:visit.accessAuthorized(this)">

and provide getTypeId() and getInstanceId() methods in your components or
make the authorisation checking method take a component instance. The
options are endless, which is the blessing of Tapestry - and curse when you
don't know where to begin ;).

/ Petter

> -----Original Message-----
> From: Alexander Fishchuk [mailto:al@ulti.kiev.ua]
> Sent: den 19 april 2004 15:13
> To: tapestry-user@jakarta.apache.org
> Subject: Component-level authorization
>
>
> Hi guys
> has anyone implemented a kind of component-level validation
> (authorization)
> with Tapestry?
>
> I need to show/hide arbitrary page components based on user's
> permissions
> Permissions are instance-level not a class level...
>
> any advice how to implement it would be appreciated
>
> thanks in advance
> Alex
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


RE: Component-level authorization

Posted by Petter Måhlén <pe...@elevance.se>.
I haven't done this, but maybe something like this in Component.html would
work:

<span jwcid="@Conditional"
condition="ognl:visit.accessAuthorized(someComponentIdentifier)">
..actual component html..
</span>

Or, if the Visit object for some reason isn't the right place for it, you
can have some kind of sub-class to BasePage that has the ability to check if
the current user is authorised to access a component, and change it to:

<span jwcid="@Conditional"
condition="ognl:page.accessAuthorized(someComponentIdentifier)">

If, by instance-level, you mean that Carl can access a User component with
id 1, but not with id 2, then the condition could be:

<span jwcid="@Conditional" condition="ognl:visit.accessAuthorized('User',
id)">

and your User.java would need a getId() method. To make it more generic,
maybe you could do something like:

<span jwcid="@Conditional" condition="ognl:visit.accessAuthorized(typeId,
instanceId)">
or
<span jwcid="@Conditional" condition="ognl:visit.accessAuthorized(this)">

and provide getTypeId() and getInstanceId() methods in your components or
make the authorisation checking method take a component instance. The
options are endless, which is the blessing of Tapestry - and curse when you
don't know where to begin ;).

/ Petter

> -----Original Message-----
> From: Alexander Fishchuk [mailto:al@ulti.kiev.ua] 
> Sent: den 19 april 2004 15:13
> To: tapestry-user@jakarta.apache.org
> Subject: Component-level authorization
> 
> 
> Hi guys
> has anyone implemented a kind of component-level validation 
> (authorization)
> with Tapestry?
> 
> I need to show/hide arbitrary page components based on user's 
> permissions
> Permissions are instance-level not a class level...
> 
> any advice how to implement it would be appreciated
> 
> thanks in advance
> Alex
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org