コード例 #1
0
  /**
   * SECURE: The password in the login properties is encrypted. Return a clone of the properties
   * with the password decrypted.
   */
  private Properties prepareProperties(Properties properties) {
    Properties result = (Properties) properties.clone();
    String password = result.getProperty("password");
    if (password != null) {
      // Fix for bug # 2700529
      // The securable object is initialized on first call of
      // getSecurableObject. When setting an encrypted password
      // we don't make this call since it is already encrypted, hence,
      // we do not initialize the securable object on the holder.
      //
      // If neither setPassword or setEncryptedPassword is called
      // (example, user sets properties via the setProperties method),
      // when the user tries to connect they  will get a null pointer
      // exception. So if the holder does not hold
      // a securable object or the setEncryptedPassword flag is not true,
      // don't bother trying to decrypt.
      if (getSecurableObjectHolder().hasSecurableObject() || isEncryptedPasswordSet) {
        result.put(
            "password", getSecurableObjectHolder().getSecurableObject().decryptPassword(password));
      }
    }

    return result;
  }
コード例 #2
0
 /**
  * PUBLIC: Some JDBC drivers require additional, driver-specific, properties. Add the specified
  * property to those to be passed to the JDBC driver.
  */
 public void setProperty(String propertyName, Object propertyValue) {
   properties.put(propertyName, propertyValue);
 }