Skip to content

Commit

Permalink
CB-4161 validate custom config status
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-skoblikov committed Oct 24, 2023
1 parent eb8614b commit 6cdc8ee
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ public SMAuthInfo authenticate(
@Nullable String authProviderConfigurationId,
@NotNull Map<String, Object> userCredentials
) throws DBException {
if (isProviderDisabled(authProviderId)) {
if (isProviderDisabled(authProviderId, authProviderConfigurationId)) {
throw new SMException("Unsupported authentication provider: " + authProviderId);
}
var authProgressMonitor = new LoggingProgressMonitor(log);
Expand Down Expand Up @@ -2732,9 +2732,17 @@ private String getUserIdOrNull() {
return activeUserCredentials.getUserId();
}

private boolean isProviderDisabled(@NotNull String providerId) {
private boolean isProviderDisabled(@NotNull String providerId, @Nullable String authConfigurationId) {
WebAuthConfiguration appConfiguration = application.getAuthConfiguration();
return !appConfiguration.isAuthProviderEnabled(providerId);
if (!appConfiguration.isAuthProviderEnabled(providerId)) {
return true;
}
if (authConfigurationId != null) {
SMAuthProviderCustomConfiguration configuration =
appConfiguration.getAuthProviderConfiguration(authConfigurationId);
return configuration == null || configuration.isDisabled();
}
return false;
}

public void clearOldAuthAttemptInfo() throws DBException {
Expand Down

0 comments on commit 6cdc8ee

Please sign in to comment.