|
Page Edited :
WICKET :
Servlet container authentication
Servlet container authentication has been edited by syl (Nov 14, 2006). Content:Integrating servlet container authentication with WicketFirst of all the difference between authentication and authorization should be mentioned. It is that authentication determines who is currently using software and authorization determines if user has access to certain resource. In the case of integrating servlet container authentication with Wicket, servlet container will authenticate user and Wicket will authorize him. MyApplication.java public final class MyApplication extends WebApplication { ... @Override protected void init() { // setting page that Wicket will display if user has no rights to access a page getApplicationSettings().setAccessDeniedPage( LoginPage.class ); // setting authorization strategy (you can use any strategy you like) getSecuritySettings().setAuthorizationStrategy( new RoleAuthorizationStrategy( new MyRoleCheckingStrategy() ) ); // mounting login page so that it can be referred to in the security constraint mountBookmarkablePage( "/login", LoginPage.class ); }
/**
* Overriding newWebRequest so that to store take user information from
* servletRequest and put it into wicket session.
*/
@Override
protected WebRequest newWebRequest( final HttpServletRequest servletRequest )
{
final WebRequest webRequest = super.newWebRequest( servletRequest );
final Session session = getSessionStore().lookup( webRequest );
if( session != null )
{
/* Save user info into session. */
( ( MySession )session ).takeUserFromRequest( servletRequest );
}
return webRequest;
}
...
}
|
Unsubscribe or edit your notifications preferences
