package org.wicketTutorial.metadataroles;
import org.apache.wicket.Page;
import org.apache.wicket.Session;
import org.apache.wicket.authroles.authentication.AbstractAuthenticatedWebSession;
import org.apache.wicket.authroles.authentication.AuthenticatedWebApplication;
import org.apache.wicket.authroles.authorization.strategies.role.Roles;
import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
import org.wicketTutorial.commons.bootstrap.layout.BootstrapBasePage;
import org.wicketTutorial.commons.bootstrap.BootstrapApp;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
import org.wicketTutorial.metadataroles.admin.AdminOnlyPage;
@see
public class WicketApplication extends AuthenticatedWebApplication{
@Override
public Class<? extends BootstrapBasePage> getHomePage(){
return HomePage.class;
}
@Override
protected Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() {
return BasicAuthenticationSession.class;
}
@Override
protected Class<? extends BootstrapBasePage> getSignInPageClass() {
return SignInPage.class;
}
@Override
public void init(){
getSecuritySettings().setAuthorizationStrategy(new MetaDataRoleAuthorizationStrategy(this));
MetaDataRoleAuthorizationStrategy.authorize(AdminOnlyPage.class, Roles.ADMIN);
}
}