List of usage examples for org.apache.wicket.util.crypt CachingSunJceCryptFactory CachingSunJceCryptFactory
public CachingSunJceCryptFactory(final String encryptionKey)
From source file:com.userweave.application.UserWeaveApplication.java
License:Open Source License
private void setupAuthorization() { UserWeaveAuthorizationStrategy authStrat = new UserWeaveAuthorizationStrategy(); RoleAuthorizationStrategy roleStrat = new RoleAuthorizationStrategy(new IRoleCheckingStrategy() { @Override//from w ww.j a va 2 s.c o m public boolean hasAnyRole(Roles roles) { /* * Only deny roles contain the empty role. If this fact changes, * go to hell. */ if (roles.hasRole("")) { return false; } else { User user = UserWeaveSession.get().getUser(); return user.isAdmin() || user.hasAnyRole(roles); } } }); roleStrat.add(authStrat); ISecuritySettings securitySettings = getSecuritySettings(); //securitySettings.setAuthorizationStrategy(authStrat); securitySettings.setAuthorizationStrategy(roleStrat); securitySettings.setUnauthorizedComponentInstantiationListener(authStrat); if (!ENCRYPTION) { securitySettings.setCryptFactory(new CachingSunJceCryptFactory( HashProvider.md5("do what you desire", System.currentTimeMillis()))); } }
From source file:sf.wicklet.ext.test.arquillian.testauth01.TestApplication.java
License:Apache License
@Override protected void init() { super.init(); getSecuritySettings()/*from w w w .j av a 2s . com*/ .setAuthenticationStrategy(new WxSecureAuthenticationStrategy(LOGGED_IN_COOKIE_NAME, true)); getSecuritySettings().setCryptFactory(new CachingSunJceCryptFactory(DEFAUT_ENCRYPTION_KEY)); mountPage(TestSigninPage.MNT_PATH, TestApplication.TestSigninPage.class); mountPage(TestRememberPage.MNT_PATH, TestApplication.TestRememberPage.class); mountPage(TestLogoutPage.MNT_PATH, TestApplication.TestLogoutPage.class); mountPage(TestSignoutPage.MNT_PATH, TestApplication.TestSignoutPage.class); mountPage(TestSecurePage.MNT_PATH, TestApplication.TestSecurePage.class); final HttpsConfig config = new HttpsConfig(HTTP_PORT, HTTPS_PORT); config.setPreferStateful(false); setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), config)); }
From source file:sf.wicklet.gwt.site.server.WickletGwtSiteApplication.java
License:Apache License
@Override protected void init() { super.init(); getSecuritySettings()/*from www . j a v a2 s. c o m*/ .setAuthenticationStrategy(new WxSecureAuthenticationStrategy(IConfig.LOGGED_IN_COOKIE_NAME, true)); getSecuritySettings() .setCryptFactory(new CachingSunJceCryptFactory(Config.get().getDefaultEncryptionKey())); getPageSettings().setPageComponentInfoCodec( new DefaultPageComponentInfoCodec(RandomUtil.getSingleton().getString(8, 16))); mount(new MyMultiMapper("s", AdminService.class, Service.class)); mount(new MyMultiMapper("p", Login.class, Logout.class, Admin.class, User.class)); final IWickletSupport support = getWickletSupport(); final HttpsConfig config = new HttpsConfig(support.getHttpPort(), support.getHttpsPort()); config.setPreferStateful(false); setRootRequestMapper(new HttpsMapper(getRootRequestMapper(), config)); }