Situation: user is forced to change password when button "Change password" is clicked. This click fires form overridden method onSubmit() (Wicket). In this method:
protected void onSubmit() {
//changing password by updating it in DB
// autologin user with changed password in system
//set response page (wicket style)
setResponsePage(RestorePasswordPage.class);
}
Actually call setResponsePage(...) is the call to Wicket Component.setResponsePage()
public final <C extends Page> void setResponsePage(final Class<C> cls)
{
getRequestCycle().setResponsePage(cls);
}
My task was to substitute wicket on Spring security and it was solved - I intercept call to this method in Spring Filter Security Chain (class below is one of the components of this chaing). And can do all the things from code snippet above except one - I don't know how to make redirection to RestorePasswordPage
public class ForgotPasswordForcePasswordChangeEventHandler implements CustomEventHandler {
public void handle(HttpServletRequest request, HttpServletResponse response) {
// 1. Extract current customer
// 2. Extract changed password
// 3. Updates user through external web service
// 4. Prepares data for authentication
// 5. Clears security context to remove current authentication
//redirect to the same page as in wicket
HOW???
}
}
Questions:
- Is it any way to get access to Wicket RequestCycle if I got only HttpServletRequest request as input.
- Any other way to solve this problem?