私はログイン ページを wicket by Java で作成していますが、できるだけ一般的に書きたいので、C++ で Function Pointer として有名な関数をクラスに渡す必要があります。クラスは次のとおりです。
class LoginForm extends Form
{
public LoginForm(String id,TextField username,TextField password,WebResponse webResponse)
{
super(id);
}
@Override
public void onSubmit()
{
String password = Login.this.getPassword();
String userId = Login.this.getUserId();
String role = authenticate(userId, password);
if (role != null)
{
if (Login.this.getSave())
{
utilities.CreateCookie("Username", userId, false, 1209600, (WebResponse) getRequestCycle().getResponse());
utilities.CreateCookie("Password", password, false, 1209600, (WebResponse) getRequestCycle().getResponse());
}
User loggedInUser = new User(userId, role);
WiaSession session = (WiaSession) getSession();
session.setUser(loggedInUser);
if (!continueToOriginalDestination())
{
setResponsePage(UserHome.class);
}
}
else
{
wrongUserPass.setVisible(true);
}
}
}
その関数はどこで認証されますか?