I am using wicket-auth and it gets me just about everything I need. I would
like the default handling of an unauthenticated user. When a page is
accessed by someone who is not logged in, I'd like them directed to the
login page, BUT I'd like a message to appear stating that their session has
timed out or they need to log in.
The default behavior of AuthenticatedWebApplication redirects the user to
the sign-in page if they are not logged in. Can that behavior be modified
easily (to pass info to the sign-in page) so the sign-in page could show an
extra message like "for security reasons your session has timed out"?
The handling of an unauthorized user is shown below (taken from
AuthenticatedWebApplication). I would simply like to override this method,
BUT it is FINAL. I guess I could just duplicate the
AuthenticatedWebApplication class, modify the onUnauthorizedInstantiation()
method, and inherit from it. But hoping one of the Wicket-heads out there
has an easier way to do this.
Also, why is the method FINAL?
public final void onUnauthorizedInstantiation(final Component component)
{
// If there is a sign in page class declared, and the
unauthorized
// component is a page, but it's not the sign in page
if (component instanceof Page)
{
if (!AuthenticatedWebSession.get().isSignedIn())
{
// Redirect to intercept page to let the user
sign in
throw new
RestartResponseAtInterceptPageException(getSignInPageClass());
}
else
{
onUnauthorizedPage((Page)component);
}
}
else
{
// The component was not a page, so throw an exception
throw new
UnauthorizedInstantiationException(component.getClass());
}
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Default-unauthorized-access-handling-tp2549533p2549533.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]