All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jasypt.web.pbeconfig.WebPBEInitializer Maven / Gradle / Ivy

There is a newer version: 6.1.2
Show newest version
/*
 * =============================================================================
 * 
 *   Copyright (c) 2007-2010, The JASYPT team (http://www.jasypt.org)
 * 
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 * 
 * =============================================================================
 */
package org.jasypt.web.pbeconfig;




/**
 * 

* 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, {@link #initializeWebPBEConfigs()}, * which the implementation class should use for creating encryptors and * setting {@link 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 {@link WebPBEInitializationContextListener} will also become * unnecessary. *

* * @since 1.3 * * @author Daniel Fernández * */ public interface WebPBEInitializer { /** *

* Method called by {@link WebPBEInitializationContextListener} at * application deploy time for initialization of jasypt encryptors. *

* */ public void initializeWebPBEConfigs(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy