Re: continueToOriginalDestination issue
I enter URL "http:///awol" which should direct to my application's home page which is set to be MainPage.class: My Application class sets the home page to be MainPage: public Class getHomePage() { return MainPage.class; } @Override protected Class getSignInPageClass() { return HomePage.class; } I used to check continueToOriginalDestination() return code and setResponsePage(MainPage.class) if it is false. But continueToOriginalDestination() no longer returns a code. Marcel suggested that I would just call both one after another, as the following: continueToOriginalDestination(); setResponsePage(new MainPage()); if continueToOriginalDestination() finds the originalDestination, it will throw an exception to go on to that originalDestination. The setResponsePage() won't get called. Is this what you were suggesting by "send your user to a default home page"? Other than this, is my code converting a Form to a StatelessForm looking all right? Thanks for your help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661669.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
Are you entering the URL of your main page or your login page? You also have to check if there is a continue-to-destination field set and if not you have to send your user to a default home page. N On Oct 2, 2013 8:18 PM, "shimin_q" wrote: > Thanks - that sounds exactly what I observed in my case where the login > page > (HomePage class) gets redisplayed after I entered the user name and > password. > > I am looking at some sample code with Stateless login forms, in addition to > using StatelessForm instead Form, a bind() is called too after > authenticate(). So I changed my LoginForm as follows (note that LoginForm > is part of my HomePage class): > > public class LoginForm extends StatelessForm { > > private static final Logger logger = > LoggerFactory.getLogger(LoginForm.class); > > private static final long serialVersionUID = 1L; > > private TextField username; > private PasswordTextField password; > > public LoginForm(String id) { > super(id, new CompoundPropertyModel(new Login())); > > username = new TextField("username"); > username.setRequired(true); > add(username); > password = new PasswordTextField("password"); > add(password); > } > > @Override > protected void onSubmit() { > Login login = getModelObject(); > > AuthenticatedWebSession session = > AuthenticatedWebSession.get(); > if(session instanceof AwolAuthenticatedWebSession) { > logger.debug("session is > AwolAuthenticatedWebSession"); > } > if (session.authenticate(login.getUsername(), > login.getPassword())) { > logger.debug("authentication successful"); > if (session.isTemporary()) { > logger.debug("session temporary, bind to > permanent"); > session.bind(); // according to sample > code, this makes the temporary > session used by the stateless login page permanent > } > > this.continueToOriginalDestination(); > } > else { > error("Invalid credentials"); > } > } > > But this code change does not seem to work either. The first time I log > in, > the session.isTemporary returns true, so it did session.bind(). But after > continueToOriginalDestination(), it is still the login page displayed, it > does not go on to MainPage. If I enter username/password again, this time, > the code seems to get a session.isTemporary returns false, and > continueToOriginalDestination() still does not go on to MainPage. > > Anything else I am missing here? Thanks for your help! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661667.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: continueToOriginalDestination issue
Thanks - that sounds exactly what I observed in my case where the login page (HomePage class) gets redisplayed after I entered the user name and password. I am looking at some sample code with Stateless login forms, in addition to using StatelessForm instead Form, a bind() is called too after authenticate(). So I changed my LoginForm as follows (note that LoginForm is part of my HomePage class): public class LoginForm extends StatelessForm { private static final Logger logger = LoggerFactory.getLogger(LoginForm.class); private static final long serialVersionUID = 1L; private TextField username; private PasswordTextField password; public LoginForm(String id) { super(id, new CompoundPropertyModel(new Login())); username = new TextField("username"); username.setRequired(true); add(username); password = new PasswordTextField("password"); add(password); } @Override protected void onSubmit() { Login login = getModelObject(); AuthenticatedWebSession session = AuthenticatedWebSession.get(); if(session instanceof AwolAuthenticatedWebSession) { logger.debug("session is AwolAuthenticatedWebSession"); } if (session.authenticate(login.getUsername(), login.getPassword())) { logger.debug("authentication successful"); if (session.isTemporary()) { logger.debug("session temporary, bind to permanent"); session.bind(); // according to sample code, this makes the temporary session used by the stateless login page permanent } this.continueToOriginalDestination(); } else { error("Invalid credentials"); } } But this code change does not seem to work either. The first time I log in, the session.isTemporary returns true, so it did session.bind(). But after continueToOriginalDestination(), it is still the login page displayed, it does not go on to MainPage. If I enter username/password again, this time, the code seems to get a session.isTemporary returns false, and continueToOriginalDestination() still does not go on to MainPage. Anything else I am missing here? Thanks for your help! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661667.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
No - it the login page was redisplayed. N On Oct 2, 2013 6:31 PM, "shimin_q" wrote: > Just to make sure the problem I am seeing is due to the timed out Login > page...when you say > > "the original login page displayed would have timed out and the attempted > login wont succeed." > > When your attempted login failed, does another page come up with some > generic browser error message or does it stay on the login page? > > In my case, after I entered the username/password, it just stays on the > login page without the "Invalid credentials" error for failed > authentication. That was why I suspected my authenticate() was OK, it was > the continueToOriginalDestination() not continuing on. > > Thanks for the help as I try to figure this out!! > > Shi-Min > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661665.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: continueToOriginalDestination issue
Just to make sure the problem I am seeing is due to the timed out Login page...when you say "the original login page displayed would have timed out and the attempted login wont succeed." When your attempted login failed, does another page come up with some generic browser error message or does it stay on the login page? In my case, after I entered the username/password, it just stays on the login page without the "Invalid credentials" error for failed authentication. That was why I suspected my authenticate() was OK, it was the continueToOriginalDestination() not continuing on. Thanks for the help as I try to figure this out!! Shi-Min -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661665.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
OK, could it be as simple as changing the following line: public class LoginForm extends Form to public class LoginForm extends StatelessForm as you can see my login page (HomePage class) is really simple (only 3 components: a label, a LoginForm, a FeedbackPanel), right? Thanks, Shi-Min -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661664.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
Any components on your Page that aren't stateless cause the Page containing them to be Stateful- Forms are stateful by default. Add this to your page's onInitialize() and it will help you see what's going on. Check out Wicket's StatelessForm class. @Override protected void onInitialize() { super.onInitialize(); visitChildren( new IVisitor() { @Override public void component( Component component, IVisit visit ) { if( component.isStateless() ) { return; } log.warn( "Not Stateless: Component: " + component.getId() + " / " + component.getMarkupId() + " - " + component.getPageRelativePath() ); } } ); } On Wed, Oct 2, 2013 at 5:05 PM, shimin_q wrote: > This could explain the intermittent nature of the problem. Thanks, Nick! > Could you elaborate on what you mean by stateless login page? Here is my > Login page and Login Form inside it. Could you please tell me what I need > to change? > > public class HomePage extends WebPage { > > public HomePage() { > add(new Label("headerMessage", "OmniVista 8770 Login")); > > add(new LoginForm("form")); > > add(new FeedbackPanel("feedback")); > } > > } > > public class LoginForm extends Form { > > private static final Logger logger = > LoggerFactory.getLogger(LoginForm.class); > > private static final long serialVersionUID = 1L; > > private TextField username; > private PasswordTextField password; > > public LoginForm(String id) { > super(id, new CompoundPropertyModel(new Login())); > > username = new TextField("username"); > username.setRequired(true); > add(username); > password = new PasswordTextField("password"); > add(password); > } > > @Override > protected void onSubmit() { > Login login = getModelObject(); > > AuthenticatedWebSession session = > AuthenticatedWebSession.get(); > if (session.authenticate(login.getUsername(), > login.getPassword())) { > logger.debug("authentication successful"); > this.continueToOriginalDestination(); > } > else { > error("Invalid credentials"); > } > } > > } > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661662.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: continueToOriginalDestination issue
This could explain the intermittent nature of the problem. Thanks, Nick! Could you elaborate on what you mean by stateless login page? Here is my Login page and Login Form inside it. Could you please tell me what I need to change? public class HomePage extends WebPage { public HomePage() { add(new Label("headerMessage", "OmniVista 8770 Login")); add(new LoginForm("form")); add(new FeedbackPanel("feedback")); } } public class LoginForm extends Form { private static final Logger logger = LoggerFactory.getLogger(LoginForm.class); private static final long serialVersionUID = 1L; private TextField username; private PasswordTextField password; public LoginForm(String id) { super(id, new CompoundPropertyModel(new Login())); username = new TextField("username"); username.setRequired(true); add(username); password = new PasswordTextField("password"); add(password); } @Override protected void onSubmit() { Login login = getModelObject(); AuthenticatedWebSession session = AuthenticatedWebSession.get(); if (session.authenticate(login.getUsername(), login.getPassword())) { logger.debug("authentication successful"); this.continueToOriginalDestination(); } else { error("Invalid credentials"); } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661662.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
hi, my original post was sent to smqian directly (stupid mobile email client). i suggested to use a "setResponsePage(new MainPage());" after continueToOriginalDestination. but this is rather a workaround than a solution, right? best regards marcel Am 02.10.2013 um 19:28 schrieb shimin_q : > Hello, > > My homepage URL is "http:///awol", and it is linked to > MainPage.html and MainPage.java. I also have a HomePage.html/HomePage.java > that is essentially a login page and contains a LoginForm. > > public Class getHomePage() { > return MainPage.class; > } > > @Override > protected Class getSignInPageClass() { > return HomePage.class; > } > > I use continueToOriginalDestination() once LoginForm submitted > username/password and was authenticated: > > protected void onSubmit() { > Login login = getModelObject(); > > AuthenticatedWebSession session = AuthenticatedWebSession.get(); > if (session.authenticate(login.getUsername(), > login.getPassword())) { > logger.debug("authentication successful"); > this.continueToOriginalDestination(); > } > else { > error("Invalid credentials"); > } > } > > I am expecting that continueToOriginalDestination would take me to the > MainPage after user successfully logged in, but intermittently, > continueToOriginalDestination() just stays on the HomePage (with the > LoginForm) even after the user name/password is authenticated. > > What could be the issue? Please help!! > > Thanks!! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
One thing to check is if your login page is stateless. If its not, and you attempt to login using your login page some time after your initially loaded the page in the browser, then the original login page displayed would have timed out and the attempted login wont succeed. Ive seen this behavior a couple of times now (after which we fix the Login Page and make it stateless) On Wed, Oct 2, 2013 at 1:28 PM, shimin_q wrote: > Hello, > > My homepage URL is "http:///awol", and it is linked to > MainPage.html and MainPage.java. I also have a HomePage.html/HomePage.java > that is essentially a login page and contains a LoginForm. > > public Class getHomePage() { > return MainPage.class; > } > > @Override > protected Class getSignInPageClass() { > return HomePage.class; > } > > I use continueToOriginalDestination() once LoginForm submitted > username/password and was authenticated: > > protected void onSubmit() { > Login login = getModelObject(); > > AuthenticatedWebSession session = > AuthenticatedWebSession.get(); > if (session.authenticate(login.getUsername(), > login.getPassword())) { > logger.debug("authentication successful"); > this.continueToOriginalDestination(); > } > else { > error("Invalid credentials"); > } > } > > I am expecting that continueToOriginalDestination would take me to the > MainPage after user successfully logged in, but intermittently, > continueToOriginalDestination() just stays on the HomePage (with the > LoginForm) even after the user name/password is authenticated. > > What could be the issue? Please help!! > > Thanks!! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: continueToOriginalDestination issue
On Wed, Oct 2, 2013 at 8:30 PM, shimin_q wrote: > Hi Martin, > > No, I did not use that. > > My understanding is that the URL ("http:///awol") takes me > to > my app's home page (MainPage.class), but is intercepted by the login page > define "is intercepted" what logic does the redirect ? > (HomePage.class in my case). After login is successful, the > continueToOriginalDestination() SOMETIMES does not seem to continue on to > MainPage. > > I am not sure how the interception happened and why sometimes > continueToOriginalDestination() does not continue on. I am really new to > wicket... > > Could you please let me know what caused this intermittent problem? > continueToOriginalDestination() would work only if RestartResponseAtInterceptPageException is thrown before > > Thanks, > Shi-Min > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661658.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: continueToOriginalDestination issue
Hi Martin, No, I did not use that. My understanding is that the URL ("http:///awol") takes me to my app's home page (MainPage.class), but is intercepted by the login page (HomePage.class in my case). After login is successful, the continueToOriginalDestination() SOMETIMES does not seem to continue on to MainPage. I am not sure how the interception happened and why sometimes continueToOriginalDestination() does not continue on. I am really new to wicket... Could you please let me know what caused this intermittent problem? Thanks, Shi-Min -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661658.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
Here is the flow of my app: My Application class sets the home page to be MainPage: > public Class getHomePage() { > return MainPage.class; > } > > @Override > protected Class getSignInPageClass() { > return HomePage.class; > } > So whenever I type the following URL "http:///awol" ( /awol is defined in apache httpd conf to be the location for my app: ProxyPass ajp://localhost:8010/awol ProxyPassReverse ajp://localhost:8010/awol ) it goes to my MainPage which is specified as the application's home page. And it is intercepted by the HomePage (which contains LoginForm). The intermittent problem for me is it appears the continueToOriginalDestination() does not take me to MainPage after authentication is successful. Hope it clarifies. Any ideas? Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654p4661657.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: continueToOriginalDestination issue
Hi, Do you use RestartResponseAtInterceptPageException in your authorization strategy ? On Wed, Oct 2, 2013 at 7:28 PM, shimin_q wrote: > Hello, > > My homepage URL is "http:///awol", and it is linked to > MainPage.html and MainPage.java. I also have a HomePage.html/HomePage.java > that is essentially a login page and contains a LoginForm. > > public Class getHomePage() { > return MainPage.class; > } > > @Override > protected Class getSignInPageClass() { > return HomePage.class; > } > > I use continueToOriginalDestination() once LoginForm submitted > username/password and was authenticated: > > protected void onSubmit() { > Login login = getModelObject(); > > AuthenticatedWebSession session = > AuthenticatedWebSession.get(); > if (session.authenticate(login.getUsername(), > login.getPassword())) { > logger.debug("authentication successful"); > this.continueToOriginalDestination(); > } > else { > error("Invalid credentials"); > } > } > > I am expecting that continueToOriginalDestination would take me to the > MainPage after user successfully logged in, but intermittently, > continueToOriginalDestination() just stays on the HomePage (with the > LoginForm) even after the user name/password is authenticated. > > What could be the issue? Please help!! > > Thanks!! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: continueToOriginalDestination issue
Hi, How user arrives to the HomePage.class ? By the security layer or by a link ? If it's by a link, continueToOriginalDestination will send the user to the original destination, which is HomePage.class. François Le 2 oct. 2013 à 19:28, shimin_q a écrit : > Hello, > > My homepage URL is "http:///awol", and it is linked to > MainPage.html and MainPage.java. I also have a HomePage.html/HomePage.java > that is essentially a login page and contains a LoginForm. > > public Class getHomePage() { > return MainPage.class; > } > > @Override > protected Class getSignInPageClass() { > return HomePage.class; > } > > I use continueToOriginalDestination() once LoginForm submitted > username/password and was authenticated: > > protected void onSubmit() { > Login login = getModelObject(); > > AuthenticatedWebSession session = AuthenticatedWebSession.get(); > if (session.authenticate(login.getUsername(), > login.getPassword())) { > logger.debug("authentication successful"); > this.continueToOriginalDestination(); > } > else { > error("Invalid credentials"); > } > } > > I am expecting that continueToOriginalDestination would take me to the > MainPage after user successfully logged in, but intermittently, > continueToOriginalDestination() just stays on the HomePage (with the > LoginForm) even after the user name/password is authenticated. > > What could be the issue? Please help!! > > Thanks!! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654.html > Sent from the Users forum mailing list archive at Nabble.com. > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >
continueToOriginalDestination issue
Hello, My homepage URL is "http:///awol", and it is linked to MainPage.html and MainPage.java. I also have a HomePage.html/HomePage.java that is essentially a login page and contains a LoginForm. public Class getHomePage() { return MainPage.class; } @Override protected Class getSignInPageClass() { return HomePage.class; } I use continueToOriginalDestination() once LoginForm submitted username/password and was authenticated: protected void onSubmit() { Login login = getModelObject(); AuthenticatedWebSession session = AuthenticatedWebSession.get(); if (session.authenticate(login.getUsername(), login.getPassword())) { logger.debug("authentication successful"); this.continueToOriginalDestination(); } else { error("Invalid credentials"); } } I am expecting that continueToOriginalDestination would take me to the MainPage after user successfully logged in, but intermittently, continueToOriginalDestination() just stays on the HomePage (with the LoginForm) even after the user name/password is authenticated. What could be the issue? Please help!! Thanks!! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/continueToOriginalDestination-issue-tp4661654.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org