Re: [Wicket-user] Authorization startegy redirect but keep parameters

2006-11-17 Thread Marc-Andre Houle

Indeed, it was what I was searching for.  The answer have probably seems too
simple for what I was wanting!

Thanks a lot Erik, it was a matter of copy/pasting to make it work and sorry
because I didn't understand you.  Also a big thanks for the explanation from
Igor since it is what made me understand the hint.

Everything seems so magical in Wicket.  Damn life is good!

Marc

On 11/16/06, Igor Vaynberg [EMAIL PROTECTED] wrote:


this is exactly what continueToOriginalDestination() coupled with
RestartResponseAtInterceptPage exceptions do.

user access url A which results in the construction of page B
authoraization strategy kicks in when B is being constructed - and you
throw a RestartResponseAtInterceptPage(C) exception.
page C is shown with a login form, in the onsubmit() when you call
continueToOriginalDestination() wicket should go back to url A

-igor


On 11/16/06, Marc-André Houle [EMAIL PROTECTED] wrote:

 In fact, the current result is going to the admin page and trashing
 the original URL while what I want was to save the original URL.
 This way, after the login, I will be able to redirect to what the
 user wanted first before the login.

 I'm not sure if I am clear enough on what I want.  The lobal thing
 is : I'm not in a page, from what I know, the Authorization strategy
 is used before the page get created at all.  But I still need the
 original URL and I don't know where to take it since I'm not in a
 Paage context.

 If there is something not clear, tell me and I'l try to explain again.

 Thanks

 Marc
 Le 06-11-16 à 16:01, Erik van Oosten a écrit :

  Hello Marc,
 
  It is indeed very easy once you know where to look :)
  Once the user is authenticated in the Login page you do something
  like this:
 
  if (!continueToOriginalDestination()) {
 setResponsePage(Application.get().getHomePage());
  }
 
  This will set the response page only when you got here directly.
  Otherwise it will use the original URL that was requested while the
  RestartResponseAtInterceptPageException was thrown in your code below.

 
  Does this solve your problem, or did I misread something?
 
   Erik.
 
 
  Marc-Andre Houle schreef:
  Hello group, it is again me for another question! :)
 
  I'm trying to build an Authorization strategy around
  AbstractPageAuthorizationStrategy.
  For now, the authorization strategy is really simple as you will see
  in this copy-paste of code :
  protected boolean isPageAuthorized(Class pageClass)
  {
  if(instanceOf(pageClass, BaseSecurePage.class) 
  ((PortalSession)Session.get()).getSessionId () ==
  null)
  {
  throw new
  RestartResponseAtInterceptPageException(Login.class);
  }
  if(instanceOf (pageClass, BaseAdminPage.class ))
  {
  return ((PortalSession)Session.get()).isUserAdmin ();
  }
  return true;
  }
 
  For now, there was no problem at all and everything is perfect. But
  the problem is, my boss want our application to support node linking
  when not logged in.  you know, like you click on the link, the
  application tell you to log in and after your log in you are
  redirected to the correct page.
  Seem's prety simple, load the class to get a page, add to this page
  the parameters used before the trigger of the authorization strategy.
  The problem is : I can't find a way to discover the page parameters.
 
  It is not accessible from the session nor the application (At least,
  from what my search in the api have done).  So for now, I'm stuck
  with
  a login page that do not know where to redirect after the login.
 
  Can somebody help me with that?
 
  Thanks in advance for the answer and really sorry if it is so
  obvious.
 
  Marc
 
 
  --
  Erik van Oosten
  http://day-to-day-stuff.blogspot.com/
 
 
  --

  ---
  Take Surveys. Earn Cash. Influence the Future of IT
  Join SourceForge.net's Techsay panel and you'll get the chance to
  share your
  opinions on IT  business topics through brief surveys - and earn cash

  http://www.techsay.com/default.php?
  page=join.phpp=sourceforgeCID=DEVDEV
  ___
  Wicket-user mailing list
  Wicket-user@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/wicket-user



 -
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to share
 your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV

 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user



-
Take Surveys. Earn Cash. 

Re: [Wicket-user] Authorization startegy redirect but keep parameters

2006-11-16 Thread Erik van Oosten
Hello Marc,

It is indeed very easy once you know where to look :)
Once the user is authenticated in the Login page you do something like this:

if (!continueToOriginalDestination()) {
   setResponsePage(Application.get().getHomePage());
}

This will set the response page only when you got here directly. 
Otherwise it will use the original URL that was requested while the 
RestartResponseAtInterceptPageException was thrown in your code below.

Does this solve your problem, or did I misread something?

 Erik.


Marc-Andre Houle schreef:
 Hello group, it is again me for another question! :)

 I'm trying to build an Authorization strategy around 
 AbstractPageAuthorizationStrategy. 
 For now, the authorization strategy is really simple as you will see 
 in this copy-paste of code :
 protected boolean isPageAuthorized(Class pageClass)
 {
 if(instanceOf(pageClass, BaseSecurePage.class) 
 ((PortalSession)Session.get()).getSessionId () == null)
 {
 throw new 
 RestartResponseAtInterceptPageException(Login.class);
 }
 if(instanceOf (pageClass, BaseAdminPage.class))
 {
 return ((PortalSession)Session.get()).isUserAdmin ();
 }
 return true;
 }

 For now, there was no problem at all and everything is perfect. But 
 the problem is, my boss want our application to support node linking 
 when not logged in.  you know, like you click on the link, the 
 application tell you to log in and after your log in you are 
 redirected to the correct page. 
 Seem's prety simple, load the class to get a page, add to this page 
 the parameters used before the trigger of the authorization strategy. 
 The problem is : I can't find a way to discover the page parameters.

 It is not accessible from the session nor the application (At least, 
 from what my search in the api have done).  So for now, I'm stuck with 
 a login page that do not know where to redirect after the login.

 Can somebody help me with that?

 Thanks in advance for the answer and really sorry if it is so obvious.

 Marc


-- 
Erik van Oosten
http://day-to-day-stuff.blogspot.com/


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Authorization startegy redirect but keep parameters

2006-11-16 Thread Marc-André Houle
In fact, the current result is going to the admin page and trashing  
the original URL while what I want was to save the original URL.   
This way, after the login, I will be able to redirect to what the  
user wanted first before the login.

I'm not sure if I am clear enough on what I want.  The lobal thing  
is : I'm not in a page, from what I know, the Authorization strategy  
is used before the page get created at all.  But I still need the  
original URL and I don't know where to take it since I'm not in a  
Paage context.

If there is something not clear, tell me and I'l try to explain again.

Thanks

Marc
Le 06-11-16 à 16:01, Erik van Oosten a écrit :

 Hello Marc,

 It is indeed very easy once you know where to look :)
 Once the user is authenticated in the Login page you do something  
 like this:

 if (!continueToOriginalDestination()) {
setResponsePage(Application.get().getHomePage());
 }

 This will set the response page only when you got here directly.
 Otherwise it will use the original URL that was requested while the
 RestartResponseAtInterceptPageException was thrown in your code below.

 Does this solve your problem, or did I misread something?

  Erik.


 Marc-Andre Houle schreef:
 Hello group, it is again me for another question! :)

 I'm trying to build an Authorization strategy around
 AbstractPageAuthorizationStrategy.
 For now, the authorization strategy is really simple as you will see
 in this copy-paste of code :
 protected boolean isPageAuthorized(Class pageClass)
 {
 if(instanceOf(pageClass, BaseSecurePage.class) 
 ((PortalSession)Session.get()).getSessionId () ==  
 null)
 {
 throw new
 RestartResponseAtInterceptPageException(Login.class);
 }
 if(instanceOf (pageClass, BaseAdminPage.class))
 {
 return ((PortalSession)Session.get()).isUserAdmin ();
 }
 return true;
 }

 For now, there was no problem at all and everything is perfect. But
 the problem is, my boss want our application to support node linking
 when not logged in.  you know, like you click on the link, the
 application tell you to log in and after your log in you are
 redirected to the correct page.
 Seem's prety simple, load the class to get a page, add to this page
 the parameters used before the trigger of the authorization strategy.
 The problem is : I can't find a way to discover the page parameters.

 It is not accessible from the session nor the application (At least,
 from what my search in the api have done).  So for now, I'm stuck  
 with
 a login page that do not know where to redirect after the login.

 Can somebody help me with that?

 Thanks in advance for the answer and really sorry if it is so  
 obvious.

 Marc


 -- 
 Erik van Oosten
 http://day-to-day-stuff.blogspot.com/


 -- 
 ---
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to  
 share your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php? 
 page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] Authorization startegy redirect but keep parameters

2006-11-16 Thread Igor Vaynberg

this is exactly what continueToOriginalDestination() coupled with
RestartResponseAtInterceptPage exceptions do.

user access url A which results in the construction of page B
authoraization strategy kicks in when B is being constructed - and you throw
a RestartResponseAtInterceptPage(C) exception.
page C is shown with a login form, in the onsubmit() when you call
continueToOriginalDestination() wicket should go back to url A

-igor


On 11/16/06, Marc-André Houle [EMAIL PROTECTED] wrote:


In fact, the current result is going to the admin page and trashing
the original URL while what I want was to save the original URL.
This way, after the login, I will be able to redirect to what the
user wanted first before the login.

I'm not sure if I am clear enough on what I want.  The lobal thing
is : I'm not in a page, from what I know, the Authorization strategy
is used before the page get created at all.  But I still need the
original URL and I don't know where to take it since I'm not in a
Paage context.

If there is something not clear, tell me and I'l try to explain again.

Thanks

Marc
Le 06-11-16 à 16:01, Erik van Oosten a écrit :

 Hello Marc,

 It is indeed very easy once you know where to look :)
 Once the user is authenticated in the Login page you do something
 like this:

 if (!continueToOriginalDestination()) {
setResponsePage(Application.get().getHomePage());
 }

 This will set the response page only when you got here directly.
 Otherwise it will use the original URL that was requested while the
 RestartResponseAtInterceptPageException was thrown in your code below.

 Does this solve your problem, or did I misread something?

  Erik.


 Marc-Andre Houle schreef:
 Hello group, it is again me for another question! :)

 I'm trying to build an Authorization strategy around
 AbstractPageAuthorizationStrategy.
 For now, the authorization strategy is really simple as you will see
 in this copy-paste of code :
 protected boolean isPageAuthorized(Class pageClass)
 {
 if(instanceOf(pageClass, BaseSecurePage.class) 
 ((PortalSession)Session.get()).getSessionId () ==
 null)
 {
 throw new
 RestartResponseAtInterceptPageException(Login.class);
 }
 if(instanceOf (pageClass, BaseAdminPage.class))
 {
 return ((PortalSession)Session.get()).isUserAdmin ();
 }
 return true;
 }

 For now, there was no problem at all and everything is perfect. But
 the problem is, my boss want our application to support node linking
 when not logged in.  you know, like you click on the link, the
 application tell you to log in and after your log in you are
 redirected to the correct page.
 Seem's prety simple, load the class to get a page, add to this page
 the parameters used before the trigger of the authorization strategy.
 The problem is : I can't find a way to discover the page parameters.

 It is not accessible from the session nor the application (At least,
 from what my search in the api have done).  So for now, I'm stuck
 with
 a login page that do not know where to redirect after the login.

 Can somebody help me with that?

 Thanks in advance for the answer and really sorry if it is so
 obvious.

 Marc


 --
 Erik van Oosten
 http://day-to-day-stuff.blogspot.com/


 --
 ---
 Take Surveys. Earn Cash. Influence the Future of IT
 Join SourceForge.net's Techsay panel and you'll get the chance to
 share your
 opinions on IT  business topics through brief surveys - and earn cash
 http://www.techsay.com/default.php?
 page=join.phpp=sourceforgeCID=DEVDEV
 ___
 Wicket-user mailing list
 Wicket-user@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/wicket-user


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user