Search in sources :

Example 1 with CachingSunJceCryptFactory

use of org.apache.wicket.util.crypt.CachingSunJceCryptFactory in project wicket by apache.

the class DefaultAuthenticationStrategy method getCrypt.

/**
 * @return The crypt engine to be used
 */
protected ICrypt getCrypt() {
    if (crypt == null) {
        CachingSunJceCryptFactory cryptFactory = new CachingSunJceCryptFactory(encryptionKey);
        crypt = cryptFactory.newCrypt();
    }
    return crypt;
}
Also used : CachingSunJceCryptFactory(org.apache.wicket.util.crypt.CachingSunJceCryptFactory)

Example 2 with CachingSunJceCryptFactory

use of org.apache.wicket.util.crypt.CachingSunJceCryptFactory in project wicket by apache.

the class CryptoMapperTest method before.

/**
 * Creates the {@link CryptoMapper}
 *
 * @throws Exception
 */
@Before
public void before() throws Exception {
    tester = new WicketTester(HomePage.class);
    WebApplication application = tester.getApplication();
    application.mountPage(MOUNTED_URL, Page1.class);
    /**
     * Use explicit crypt provider to prevent crypt warning output, see
     * SecuritySettings#getCryptFactory()
     */
    Supplier<ICrypt> cryptProvider = new Supplier<ICrypt>() {

        private ICryptFactory cryptFactory = new CachingSunJceCryptFactory(SecuritySettings.DEFAULT_ENCRYPTION_KEY);

        @Override
        public ICrypt get() {
            return cryptFactory.newCrypt();
        }
    };
    mapper = new CryptoMapper(application.getRootRequestMapper(), cryptProvider);
}
Also used : ICryptFactory(org.apache.wicket.util.crypt.ICryptFactory) ICrypt(org.apache.wicket.util.crypt.ICrypt) CachingSunJceCryptFactory(org.apache.wicket.util.crypt.CachingSunJceCryptFactory) Supplier(java.util.function.Supplier) WicketTester(org.apache.wicket.util.tester.WicketTester) WebApplication(org.apache.wicket.protocol.http.WebApplication) Before(org.junit.Before)

Aggregations

CachingSunJceCryptFactory (org.apache.wicket.util.crypt.CachingSunJceCryptFactory)2 Supplier (java.util.function.Supplier)1 WebApplication (org.apache.wicket.protocol.http.WebApplication)1 ICrypt (org.apache.wicket.util.crypt.ICrypt)1 ICryptFactory (org.apache.wicket.util.crypt.ICryptFactory)1 WicketTester (org.apache.wicket.util.tester.WicketTester)1 Before (org.junit.Before)1