List of usage examples for org.apache.wicket.authorization.strategies CompoundAuthorizationStrategy add
public final void add(IAuthorizationStrategy strategy)
From source file:de.tudarmstadt.ukp.csniper.webapp.WicketApplication.java
License:Apache License
@Override public void init() { addResourceReplacement(WiQueryCoreThemeResourceReference.get(), theme); if (!isInitialized) { super.init(); getRequestCycleSettings().setTimeout(Duration.minutes(10)); getComponentInstantiationListeners().add(new SpringComponentInjector(this)); CompoundAuthorizationStrategy autr = new CompoundAuthorizationStrategy(); autr.add(new AnnotationsRoleAuthorizationStrategy(this)); autr.add(new MetaDataRoleAuthorizationStrategy(this)); getSecuritySettings().setAuthorizationStrategy(autr); mountPage("/login.html", getSignInPageClass()); mountPage("/analysis.html", AnalysisPage.class); mountPage("/evaluation.html", EvaluationPage.class); mountPage("/project.html", ProjectPage.class); mountPage("/type.html", AnnotationTypePage.class); mountPage("/statistics.html", StatisticsPage.class); mountPage("/statistics2.html", StatisticsPage2.class); // mountPage("/export.html", ExportPage.class); mountPage("/search.html", SearchPage.class); mountPage("/welcome.html", getHomePage()); // mountPage("/exportHtml.html", ExportHtmlPage.class); mountPage("/users.html", ManageUsersPage.class); isInitialized = true;//from w w w . j a va 2 s.co m } }
From source file:dk.teachus.frontend.TeachUsApplication.java
License:Apache License
@Override protected void init() { if (getServletContext().getInitParameter("doDynamicDataImport") != null) { getDynamicDataImport().doImport(); }// ww w. j ava2 s . c om // Settings CompoundAuthorizationStrategy authorizationStrategy = new CompoundAuthorizationStrategy(); authorizationStrategy.add(new TeachUsCookieAuthentication()); authorizationStrategy.add(new TeachUsAuthentication()); getSecuritySettings().setAuthorizationStrategy(authorizationStrategy); getApplicationSettings().setPageExpiredErrorPage(PageExpiredPage.class); getApplicationSettings().setInternalErrorPage(InternalErrorPage.class); getExceptionSettings().setUnexpectedExceptionDisplay(IExceptionSettings.SHOW_INTERNAL_ERROR_PAGE); getMarkupSettings().setStripWicketTags(true); if (getConfigurationType() == RuntimeConfigurationType.DEVELOPMENT) { getRequestCycleSettings().addResponseFilter(new AjaxServerAndClientTimeFilter()); } loadConfiguration(); mountPages(); mountResources(); }
From source file:org.devgateway.eudevfin.ui.common.spring.WicketSpringApplication.java
License:Open Source License
@Override protected void init() { super.init(); configureBootstrap();/* www .ja va2 s.c o m*/ configureResourceBundles(); //http://stackoverflow.com/questions/15996913/wicket-avoid-302-redirect-to-homepage //getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER); setHeaderResponseDecorator(new RenderJavaScriptToFooterHeaderResponseDecorator()); //mount annotated pages new AnnotatedMountScanner().scanPackage("org.devgateway.eudevfin").mount(this); //implemented ApplicationContextAware and added context as a parameter to help JUnit tests work getComponentInstantiationListeners().add(new SpringComponentInjector(this, springContext, true)); if (getSecuritySettings().getAuthorizationStrategy() instanceof CompoundAuthorizationStrategy) { CompoundAuthorizationStrategy cas = (CompoundAuthorizationStrategy) getSecuritySettings() .getAuthorizationStrategy(); cas.add(new PermissionAuthorizationStrategy()); } getResourceSettings().setUseMinifiedResources(false); //prevents bug in wicket-bootstrap that's trying to minify a png getApplicationSettings().setDefaultMaximumUploadSize(Bytes.megabytes(5));//set maximum file size for upload form //DEPLOYMENT MODE? if (RuntimeConfigurationType.DEPLOYMENT.equals(this.getConfigurationType())) { //compress resources getResourceSettings().setJavaScriptCompressor( new GoogleClosureJavaScriptCompressor(CompilationLevel.SIMPLE_OPTIMIZATIONS)); getResourceSettings().setCssCompressor(new YuiCssCompressor()); } else { //see https://issues.apache.org/jira/browse/WICKET-5388 //we do not use SessionSizeDebugPanel List<IDebugBarContributor> debugContributors = new ArrayList<>(); debugContributors.add(VersionDebugContributor.DEBUG_BAR_CONTRIB); debugContributors.add(InspectorDebugPanel.DEBUG_BAR_CONTRIB); debugContributors.add(SessionSizeDebugPanel.DEBUG_BAR_CONTRIB); DebugBar.setContributors(debugContributors, this); } //set response for session timeout: getApplicationSettings().setPageExpiredErrorPage(LoginPage.class); //add the navbar // Navbar navbar = new Navbar("navbar"); // navbar.setPosition(Navbar.Position.TOP); // // show brand name // navbar.brandName(Model.of("EU-DEVFIN")); // //register the navbar as a spring bean // springContext.getAutowireCapableBeanFactory().initializeBean(navbar, "wicketNavbar"); }