작동하지 않는 원래의 페이지로 리디렉션합니다.나는 개찰구 7.8.0 응용 프로그램을 만들려고하고, 그리고 모든 로그인하기 전에 액세스 원래의 페이지로 페이지 리디렉션을 제외하고 제대로 작동
을 나는 확보에 액세스하려고 할 때마다 페이지에 로그인하지 않아도 SignIn 페이지로 올바르게 리디렉션되지만 일단 로그인하면 원래 페이지 대신 홈페이지로 리디렉션됩니다. 여기
내 응용 프로그램 클래스입니다 : , 나는 매우 단순화 로그인 페이지 사용하고 로그인하기 위해public class MyApplication extends AuthenticatedWebApplication {
...
@Override
public void init() {
super.init();
MetaDataRoleAuthorizationStrategy.authorize(HomePage.class, "TEST_ROLE");
MetaDataRoleAuthorizationStrategy.authorize(SecuredPage.class, "TEST_ROLE");
this.mountPage("signin", SignInPage.class);
this.mountPage("homepage", HomePage.class);
this.mountPage("secured/secured", SecuredPage.class);
//this page is secured with annotations
this.mountPage("secured/another", AnotherSecuredPage.class);
this.getRequestCycleSettings().setGatherExtendedBrowserInfo(true);
}
}
: 적어도 한 번에 최대한 빨리 로그인 한 것처럼
public class SignInPage extends WebPage {
private String username;
private String password;
private static final long serialVersionUID = 8096706227164750788L;
public SignInPage() {
this.add(new FeedbackPanel("feedback"));
final Form<SignInPage> form = new Form<>("form");
form.add(new TextField<>("username", new PropertyModel<String>(this, "username")));
form.add(new PasswordTextField("password", new PropertyModel<String>(this, "password")));
form.add(new SubmitLink("submit") {
private static final long serialVersionUID = 6057698894229534492L;
@Override
public void onSubmit() {
final Session session = SignInPage.this.getSession();
if(session.signIn(SignInPage.this.username, SignInPage.this.password)) {
this.continueToOriginalDestination();
setResponsePage(getApplication().getHomePage());
}
else {
SignInPage.this.error("Bad username/password combo!");
}
}
});
final WebClientInfo clientInfo = (WebClientInfo) this.getSession().getClientInfo();
this.add(new Label("userAgent", clientInfo.getUserAgent()));
this.add(form);
}
}
을 응용 프로그램을 다시 로그 아웃하면 다시 로그인 할 때마다 원래 페이지로 리다이렉트가 작동합니다.
내가 뭘 잘못하고 있니?
wicket-examples을 더 잘 보시고, 이것을 위해 'mother class for pages'가 필요하지 않습니다 : https://github.com/apache/wicket/blob/master/wicket-auth-roles/src /main/java/org/apache/wicket/authroles/authentication/AuthenticatedWebApplication.java – svenmeier
사실, 나는 이것을 알아 채지 못했습니다! 그리고 그것은 확실히 onConfigure() 메소드가 처음에 호출되지 않는 이유입니다. –