Application.get().getSecuritySettings().setUnauthorizedComponentInstantiationListener( new IUnauthorizedComponentInstantiationListener()
Application.get().getSecuritySettings().setUnauthorizedComponentInstantiationListener( new IUnauthorizedComponentInstantiationListener()
@Override public void init(WebApplication webApplication) { AnnotationsShiroAuthorizationStrategy authz = new AnnotationsShiroAuthorizationStrategy(); webApplication.getSecuritySettings().setAuthorizationStrategy( authz ); if ( classCandidates.getSignInPageCandidates().size() <= 0 ) { throw new IllegalStateException( "Couln't find sign in page - please annotate the sign in page with @" + WicketSignInPage.class.getName() ); } if ( classCandidates.getAccessDeniedPageCandidates().size() <= 0 ) { throw new IllegalStateException( "Couln't find access denied in page - please annotate the sign in page with @" + WicketAccessDeniedPage.class.getName() ); } Class<WebPage> signInPage = classCandidates.getSignInPageCandidates().iterator().next().getCandidate(); Class<Page> accessDeniedPage = classCandidates.getAccessDeniedPageCandidates().iterator().next().getCandidate(); webApplication.getSecuritySettings() .setUnauthorizedComponentInstantiationListener( new ShiroUnauthorizedComponentListener( signInPage, accessDeniedPage, authz ) ); }
@Override public void init(WebApplication webApplication) { AnnotationsShiroAuthorizationStrategy authz = new AnnotationsShiroAuthorizationStrategy(); webApplication.getSecuritySettings().setAuthorizationStrategy( authz ); if ( classCandidates.getSignInPageCandidates().size() <= 0 ) { throw new IllegalStateException( "Couln't find sign in page - please annotate the sign in page with @" + WicketSignInPage.class.getName() ); } if ( classCandidates.getAccessDeniedPageCandidates().size() <= 0 ) { throw new IllegalStateException( "Couln't find access denied in page - please annotate the sign in page with @" + WicketAccessDeniedPage.class.getName() ); } Class<WebPage> signInPage = classCandidates.getSignInPageCandidates().iterator().next().getCandidate(); Class<Page> accessDeniedPage = classCandidates.getAccessDeniedPageCandidates().iterator().next().getCandidate(); webApplication.getSecuritySettings() .setUnauthorizedComponentInstantiationListener( new ShiroUnauthorizedComponentListener( signInPage, accessDeniedPage, authz ) ); }
/** * @see org.apache.wicket.protocol.http.WebApplication#init() */ @Override protected void init() { super.init(); // Set authorization strategy and unauthorized instantiation listener getSecuritySettings().setAuthorizationStrategy(new RoleAuthorizationStrategy(this)); getSecuritySettings().setUnauthorizedComponentInstantiationListener(this); }
/** * @see org.apache.wicket.protocol.http.WebApplication#init() */ @Override protected void init() { super.init(); // Set authorization strategy and unauthorized instantiation listener getSecuritySettings().setAuthorizationStrategy(new RoleAuthorizationStrategy(this)); getSecuritySettings().setUnauthorizedComponentInstantiationListener(this); }
/** * @see org.apache.wicket.protocol.http.WebApplication#init() */ @Override protected void init() { super.init(); // Add overrides for bookmarkable and nonbookmarkable page creations to allow servlet container // authorization mechanism to handle redirect to login page. final ContainerSecurityInterceptorListener listener = new ContainerSecurityInterceptorListener(); getSecuritySettings().setUnauthorizedComponentInstantiationListener(listener); getRequestCycleListeners().add(listener); autoMountPages(); }
@Override protected void init() { getMarkupSettings().setStripWicketTags(true); // Configure Shiro AnnotationsShiroAuthorizationStrategy authz = new AnnotationsShiroAuthorizationStrategy(); getSecuritySettings().setAuthorizationStrategy(authz); getSecuritySettings().setUnauthorizedComponentInstantiationListener( new ShiroUnauthorizedComponentListener(LoginPage.class, UnauthorizedPage.class, authz)); mountPage("account/login", LoginPage.class); mountPage("account/logout", LogoutPage.class); mountPage("admin", RequireAdminRolePage.class); mountPage("view", RequireViewPermissionPage.class); mountPage("auth", RequireAuthPage.class); }
final MyAuthorizationStrategy authStrategy = new MyAuthorizationStrategy(); getSecuritySettings().setAuthorizationStrategy(authStrategy); getSecuritySettings().setUnauthorizedComponentInstantiationListener(authStrategy);