Re: Possible to override onActivate from an extended page?

2009-01-21 Thread Peter Stavrinides
Hi James,

Consider that a dispatcher/request filter enables you to remove security 
concerns from your pages, this has several advantages, i.e.: separation of 
concerns, extensibility, and pipelining, which can be extremely useful for 
layered security, take for instance this use case:

- Authenticate
- Authorize
- Audit session start/end
- Audit Resource Access (Page/Component etc)
- Secure Some Pages

IMHO the easiest and cleanest way to do all this is with a pipeline of request 
filters, I can't imagine trying to maintain all of it in my pages. Although you 
could probably do something similar using multiple base pages and an 
inheritance hierarchy.

I also use a base page, but prefer to use it to propagate logic that is common 
to every page (keeping it completely generic).

Kind regards,
Peter

 
- Original Message -
From: James Sherwood jsherw...@rgisolutions.com
To: Tapestry users users@tapestry.apache.org
Sent: Monday, 19 January, 2009 20:02:07 GMT +02:00 Athens, Beirut, Bucharest, 
Istanbul
Subject: Possible to override onActivate from an extended page?

Hello,

 

I have a login only application and for the most part you just need to be
logged in to use it except for a couple of pages.

 

To enforce this I made a class:

 

Class SecurePage{

 

Object onActivate(){

If(!visitExists){

Return index.class;

}

Return null;

 

}

 

I just then extend my pages with this one.(which will have other various
methods common to many pages)

 

My problem:  Is there a way to override the onActivate (or a way around it)
in the page that extends SecurePage so I could perform additional security
checks?

 

Thanks,

--James


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Possible to override onActivate from an extended page?

2009-01-19 Thread Thiago H. de Paula Figueiredo
Em Mon, 19 Jan 2009 15:02:07 -0300, James Sherwood  
jsherw...@rgisolutions.com escreveu:


My problem:  Is there a way to override the onActivate (or a way around  
it) in the page that extends SecurePage so I could perform additional  
security checks?


Short answer: yes, ordinary inheritence works for Tapestry pages too.

Not so short answer: you can have more methods invoked when the page is  
requested:

@OnEvent(activate)
public Object doSomething() { ... }

Long answer: user authentication and other cross-page logic is usually  
better implemented in RequestFilters. Search this mailing list and the  
wiki for examples. :)


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



RE: Possible to override onActivate from an extended page?

2009-01-19 Thread James Sherwood
Hello,

Short answer: It is in a different package(base) so the override won't work
for a page class in the pages package(or so says my compiler:).

Not so short answer: I really like this thanks!

Long answer:  Looking into it but what is the advantage over just the more
simple 'activate'?

--James


-Original Message-
From: Thiago H. de Paula Figueiredo [mailto:thiag...@gmail.com] 
Sent: January-19-09 3:07 PM
To: Tapestry users
Subject: Re: Possible to override onActivate from an extended page?

Em Mon, 19 Jan 2009 15:02:07 -0300, James Sherwood  
jsherw...@rgisolutions.com escreveu:

 My problem:  Is there a way to override the onActivate (or a way around  
 it) in the page that extends SecurePage so I could perform additional  
 security checks?

Short answer: yes, ordinary inheritence works for Tapestry pages too.

Not so short answer: you can have more methods invoked when the page is  
requested:
@OnEvent(activate)
public Object doSomething() { ... }

Long answer: user authentication and other cross-page logic is usually  
better implemented in RequestFilters. Search this mailing list and the  
wiki for examples. :)

-- 
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org



Re: Possible to override onActivate from an extended page?

2009-01-19 Thread Thiago H. de Paula Figueiredo
Em Mon, 19 Jan 2009 15:54:32 -0300, James Sherwood  
jsherw...@rgisolutions.com escreveu:



Hello,


Hi!

Short answer: It is in a different package(base) so the override won't  
work for a page class in the pages package(or so says my compiler:).


If you declared it package-private (no access modifiers), your compiler is  
right. :)

You can declare public or protected event handlers methods if you want.


Not so short answer: I really like this thanks!

Long answer:  Looking into it but what is the advantage over just the  
more simple 'activate'?


You don't have to make your pages extend a base page. All the user access  
logic stays in one place.


--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

-
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org