Skip to content

Commit

Permalink
Removed flush connection on return option
Browse files Browse the repository at this point in the history
  • Loading branch information
bekwam committed Nov 16, 2024
1 parent 45774aa commit 34fb44a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 24 deletions.
16 changes: 3 additions & 13 deletions src/main/java/com/bekwam/spi/users/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public class Config {

private final String maxSize;

private final boolean flushOnClose;

private final boolean metricsEnabled;

private final String usernameCase;
Expand All @@ -50,7 +48,6 @@ public Config(String connectionURL,
String rolesSQL,
String minSize,
String maxSize,
boolean flushOnClose,
boolean metricsEnabled,
String usernameCase,
String validationTimeout,
Expand All @@ -65,7 +62,6 @@ public Config(String connectionURL,
this.rolesSQL = rolesSQL;
this.minSize = minSize;
this.maxSize = maxSize;
this.flushOnClose = flushOnClose;
this.metricsEnabled = metricsEnabled;
this.usernameCase = usernameCase;
this.validationTimeout = validationTimeout;
Expand All @@ -84,7 +80,6 @@ public static Config from(ComponentModel config) {
config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_ROLES_QUERY),
config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_MIN_SIZE),
config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_MAX_SIZE),
Boolean.valueOf(config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_FLUSH_ON_CLOSE)),
Boolean.valueOf(config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_METRICS_ENABLED)),
config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_USERNAME_CASE),
config.getConfig().getFirst(Constants.PROVIDER_PROPERTY_VALIDATION_TIMEOUT),
Expand Down Expand Up @@ -132,10 +127,6 @@ public String getMaxSize() {
return maxSize;
}

public boolean isFlushOnClose() {
return flushOnClose;
}

public boolean isMetricsEnabled() {
return metricsEnabled;
}
Expand Down Expand Up @@ -170,27 +161,26 @@ public String getValidationSQL() {

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Config config = (Config) o;
return flushOnClose == config.flushOnClose && metricsEnabled == config.metricsEnabled && Objects.equals(connectionURL, config.connectionURL) && Objects.equals(username, config.username) && Objects.equals(password, config.password) && Objects.equals(usersSQL, config.usersSQL) && Objects.equals(rolesSQL, config.rolesSQL) && Objects.equals(minSize, config.minSize) && Objects.equals(maxSize, config.maxSize) && Objects.equals(usernameCase, config.usernameCase) && Objects.equals(validationTimeout, config.validationTimeout) && Objects.equals(dbVendor, config.dbVendor) && Objects.equals(allUsersSQL, config.allUsersSQL) && Objects.equals(searchUsersSQL, config.searchUsersSQL) && Objects.equals(validationSQL, config.validationSQL);
return metricsEnabled == config.metricsEnabled && Objects.equals(connectionURL, config.connectionURL) && Objects.equals(username, config.username) && Objects.equals(password, config.password) && Objects.equals(usersSQL, config.usersSQL) && Objects.equals(rolesSQL, config.rolesSQL) && Objects.equals(minSize, config.minSize) && Objects.equals(maxSize, config.maxSize) && Objects.equals(usernameCase, config.usernameCase) && Objects.equals(validationTimeout, config.validationTimeout) && Objects.equals(dbVendor, config.dbVendor) && Objects.equals(allUsersSQL, config.allUsersSQL) && Objects.equals(searchUsersSQL, config.searchUsersSQL) && Objects.equals(validationSQL, config.validationSQL);
}

@Override
public int hashCode() {
return Objects.hash(connectionURL, username, password, usersSQL, rolesSQL, minSize, maxSize, flushOnClose, metricsEnabled, usernameCase, validationTimeout, dbVendor, allUsersSQL, searchUsersSQL, validationSQL);
return Objects.hash(connectionURL, username, password, usersSQL, rolesSQL, minSize, maxSize, metricsEnabled, usernameCase, validationTimeout, dbVendor, allUsersSQL, searchUsersSQL, validationSQL);
}

@Override
public String toString() {
return "Config{" +
"connectionURL='" + connectionURL + '\'' +
", username='" + username + '\'' +
", password='" + password + '\'' +
", usersSQL='" + usersSQL + '\'' +
", rolesSQL='" + rolesSQL + '\'' +
", minSize='" + minSize + '\'' +
", maxSize='" + maxSize + '\'' +
", flushOnClose=" + flushOnClose +
", metricsEnabled=" + metricsEnabled +
", usernameCase='" + usernameCase + '\'' +
", validationTimeout='" + validationTimeout + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ public List<ProviderConfigProperty> create() {
.helpText("Maximum # of DB connections in pool")
.add();

builder
.property().name(Constants.PROVIDER_PROPERTY_FLUSH_ON_CLOSE)
.type(ProviderConfigProperty.BOOLEAN_TYPE)
.label("Flush On Close")
.defaultValue(Boolean.FALSE)
.helpText("Flush connections on return to pool (TRUE is discouraged because a big performance penalty was discovered)")
.add();

builder
.property().name(Constants.PROVIDER_PROPERTY_METRICS_ENABLED)
.type(ProviderConfigProperty.BOOLEAN_TYPE)
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/bekwam/spi/users/config/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class Constants {
public final static String PROVIDER_PROPERTY_ROLES_QUERY = "roles_query";
public final static String PROVIDER_PROPERTY_MIN_SIZE = "min_size";
public final static String PROVIDER_PROPERTY_MAX_SIZE = "max_size";
public final static String PROVIDER_PROPERTY_FLUSH_ON_CLOSE = "flush_on_close";
public final static String PROVIDER_PROPERTY_METRICS_ENABLED = "metrics_enabled";
public final static String PROVIDER_PROPERTY_USERNAME_CASE = "username_case";
public final static String PROVIDER_PROPERTY_VALIDATION_TIMEOUT = "validation_timeout";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public boolean isValid(RealmModel realmModel, UserModel userModel, CredentialInp

// Compute the hash
var computedHash = new SHA256PasswordEncoder().encode(enteredPassword);
LOGGER.debug("computedHash=" + computedHash);

// Check if the computed hash matches the stored password hash
return storedPassword.equals(computedHash);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ public void initFactory(String componentId, Config config) throws SQLException {
)
.initialSql(config.getValidationSQL())
)
.flushOnClose(config.isFlushOnClose())
.minSize(config.getMinSizeAsInt())
.initialSize(config.getMinSizeAsInt())
.maxSize(config.getMaxSizeAsInt())
Expand Down

0 comments on commit 34fb44a

Please sign in to comment.