Example usage for org.apache.wicket.core.util.crypt KeyInSessionSunJceCryptFactory KeyInSessionSunJceCryptFactory

List of usage examples for org.apache.wicket.core.util.crypt KeyInSessionSunJceCryptFactory KeyInSessionSunJceCryptFactory

Introduction

In this page you can find the example usage for org.apache.wicket.core.util.crypt KeyInSessionSunJceCryptFactory KeyInSessionSunJceCryptFactory.

Prototype

public KeyInSessionSunJceCryptFactory() 

Source Link

Document

Constructor using javax.crypto.Cipher org.apache.wicket.util.crypt.SunJceCrypt#DEFAULT_CRYPT_METHOD

Usage

From source file:de.alpharogroup.wicket.base.examples.application.WicketApplication.java

License:Apache License

/**
 * @see org.apache.wicket.Application#init()
 *///w w w.j  ava 2 s.c  o m
@Override
public void init() {
    super.init();

    // install crypto mapper to encrypt all application urls
    getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory());
    setRootRequestMapper(new HighScoreRequestMapper().register(new CryptoMapper(getRootRequestMapper(), this)));
    initializeAllHeaderContributors();
    new AnnotatedMountScanner().scanPackage(getPackageToScan()).mount(this);
    // add your configuration here
}

From source file:org.sakaiproject.profile2.tool.ProfileApplication.java

License:Educational Community License

protected void init() {
    super.init();

    //Configure for Spring injection
    getComponentInstantiationListeners().add(new SpringComponentInjector(this));

    getResourceSettings().setThrowExceptionOnMissingResource(false);
    getMarkupSettings().setStripWicketTags(true);
    getMarkupSettings().setDefaultBeforeDisabledLink(null);
    getMarkupSettings().setDefaultAfterDisabledLink(null);

    // On Wicket session timeout, redirect to main page
    getApplicationSettings().setPageExpiredErrorPage(MyProfile.class);
    getApplicationSettings().setAccessDeniedPage(MyProfile.class);

    // Custom resource loader since our properties are not in the default location
    getResourceSettings().getStringResourceLoaders().add(new ProfileStringResourceLoader());

    // Throw RuntimeExceptions so they are caught by the Sakai ErrorReportHandler
    getRequestCycleListeners().add(new SakaiRequestCycleListener());

    //page mounting so async calls work correctly with the cryptomapper
    mountPage("/messages", MyMessages.class);

    //encrypt URLs
    //this immediately sets up a session (note that things like css now becomes bound to the session)
    getSecuritySettings().setCryptFactory(new KeyInSessionSunJceCryptFactory()); //diff key per user
    final IRequestMapper cryptoMapper = new CryptoMapper(getRootRequestMapper(), this);
    setRootRequestMapper(cryptoMapper);//from  w  w  w  .  j  av  a2s.  c o m

}