org.jasypt.web.pbeconfig
Interface WebPBEInitializer


public interface WebPBEInitializer

Interface which must be implemented by the user-defined classes which create and initialize webapp PBE encryptors for being configured through the web pbe configuration servlet.

This interface only has one method, initializeWebPBEConfigs(), which the implementation class should use for creating encryptors and setting WebPBEConfig objects to them, like:

  package myapp;
  ... 
  public class MyWebPBEInitializer implements WebPBEInitializer {
  
      public void initializeWebPBEConfigs() {
      
          StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
          encryptor.setAlgorithm("PBEWithMD5AndDES");
          
          WebPBEConfig webConfig = new WebPBEConfig();
          webConfig.setValidationWord("jasypt");
          webConfig.setName("Main Password");

          encryptor.setConfig(webConfig);
          
          // Get some user-defined singleton or similar, and register
          // the encryptor with it so that it can be accessed from the
          // rest of the application.
          
      }
      
  }
 

All WebPBEConfig objects get internally registered at instantiation time, and once assigned to an encryptor they will appear in the web form for password setting.

Important: If the web application uses Spring Framework, WebPBEConfig objects are declared as beans in the Spring context and this Spring context is initialized at application deploy time (with Spring's ContextLoaderListener), it will NOT be necessary to create any classes implementing this WebPBEInitializer interface. The use WebPBEInitializationContextListener will also become unnecessary.

Since:
1.3
Author:
Daniel Fernández

Method Summary
 void initializeWebPBEConfigs()
           Method called by WebPBEInitializationContextListener at application deploy time for initialization of jasypt encryptors.
 

Method Detail

initializeWebPBEConfigs

void initializeWebPBEConfigs()

Method called by WebPBEInitializationContextListener at application deploy time for initialization of jasypt encryptors.



Copyright © 2011 The JASYPT team. All Rights Reserved.