Fix not masked properties
This commit is contained in:
parent
4f1bca75bc
commit
c4378c1c9d
|
@ -53,6 +53,7 @@ import org.hibernate.boot.cfgxml.spi.LoadedConfig;
|
||||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||||
import org.hibernate.boot.spi.MetadataImplementor;
|
import org.hibernate.boot.spi.MetadataImplementor;
|
||||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.cfg.Settings;
|
import org.hibernate.cfg.Settings;
|
||||||
import org.hibernate.context.internal.JTASessionContext;
|
import org.hibernate.context.internal.JTASessionContext;
|
||||||
|
@ -225,7 +226,7 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
|
|
||||||
this.properties = new HashMap<>();
|
this.properties = new HashMap<>();
|
||||||
this.properties.putAll( serviceRegistry.getService( ConfigurationService.class ).getSettings() );
|
this.properties.putAll( serviceRegistry.getService( ConfigurationService.class ).getSettings() );
|
||||||
|
maskOutSensitiveInformation(this.properties);
|
||||||
this.sqlFunctionRegistry = new SQLFunctionRegistry( jdbcServices.getJdbcEnvironment().getDialect(), options.getCustomSqlFunctionMap() );
|
this.sqlFunctionRegistry = new SQLFunctionRegistry( jdbcServices.getJdbcEnvironment().getDialect(), options.getCustomSqlFunctionMap() );
|
||||||
this.cacheAccess = this.serviceRegistry.getService( CacheImplementor.class );
|
this.cacheAccess = this.serviceRegistry.getService( CacheImplementor.class );
|
||||||
this.criteriaBuilder = new CriteriaBuilderImpl( this );
|
this.criteriaBuilder = new CriteriaBuilderImpl( this );
|
||||||
|
@ -1478,4 +1479,15 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
||||||
final String name = isNamed ? ois.readUTF() : null;
|
final String name = isNamed ? ois.readUTF() : null;
|
||||||
return (SessionFactoryImpl) locateSessionFactoryOnDeserialization( uuid, name );
|
return (SessionFactoryImpl) locateSessionFactoryOnDeserialization( uuid, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void maskOutSensitiveInformation(Map<String, Object> props) {
|
||||||
|
maskOutIfSet( props, AvailableSettings.JPA_JDBC_USER );
|
||||||
|
maskOutIfSet( props, AvailableSettings.PASS );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void maskOutIfSet(Map<String, Object> props, String setting) {
|
||||||
|
if ( props.containsKey( setting ) ) {
|
||||||
|
props.put( setting, "****" );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue