org.jasypt.hibernate4.connectionprovider
Class EncryptedPasswordDriverManagerConnectionProvider

Object
  extended by org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl
      extended by org.jasypt.hibernate4.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider
All Implemented Interfaces:
java.io.Serializable, org.hibernate.service.jdbc.connections.spi.ConnectionProvider, org.hibernate.service.Service, org.hibernate.service.spi.Configurable, org.hibernate.service.spi.Stoppable, org.hibernate.service.spi.Wrapped

public final class EncryptedPasswordDriverManagerConnectionProvider
extends org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl

Extension of DriverManagerConnectionProviderImpl that allows the user to write the datasource configuration parameters in an encrypted manner in the hibernate.cfg.xml or hibernate.properties file

The encryptable parameters are:

The name of the password encryptor (decryptor, in fact) will be set in property hibernate.connection.encryptor_registered_name. Its value must be the name of a PBEStringEncryptor object previously registered within HibernatePBEEncryptorRegistry.

An example hibernate.cfg.xml file:

  <hibernate-configuration>

    <session-factory>

      <!-- Database connection settings -->
      <property name="connection.provider_class">org.jasypt.hibernate.connectionprovider.EncryptedPasswordDriverManagerConnectionProvider</property>
      <property name="connection.encryptor_registered_name">stringEncryptor</property>
      <property name="connection.driver_class">org.postgresql.Driver</property>
      <property name="connection.url">jdbc:postgresql://localhost/mydatabase</property>
      <property name="connection.username">myuser</property>
      <property name="connection.password">ENC(T6DAe34NasW==)</property>
      <property name="connection.pool_size">5</property>
      
      ...
      
    </session-factory>
    
    ...
    
  </hibernate-configuration>
 

Since:
1.9.0
Author:
Daniel Fernández
See Also:
Serialized Form

Constructor Summary
EncryptedPasswordDriverManagerConnectionProvider()
           
 
Method Summary
 void configure(java.util.Properties props)
           
 
Methods inherited from class org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl
closeConnection, configure, finalize, getConnection, isUnwrappableAs, stop, supportsAggressiveRelease, unwrap
 
Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EncryptedPasswordDriverManagerConnectionProvider

public EncryptedPasswordDriverManagerConnectionProvider()
Method Detail

configure

public void configure(java.util.Properties props)


Copyright © 2014 The JASYPT team. All Rights Reserved.