Skip to content

Commit

Permalink
Fix the problem of NoSuchMethod error of auth provider
Browse files Browse the repository at this point in the history
Signed-off-by: JohnNiang <[email protected]>
  • Loading branch information
JohnNiang committed Oct 14, 2024
1 parent 5853d41 commit 99fcfc1
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;

import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.NonNull;
Expand Down Expand Up @@ -160,7 +161,10 @@ Mono<Set<String>> fetchEnabledProviders() {
return client.fetch(ConfigMap.class, SystemSetting.SYSTEM_CONFIG)
.map(configMap -> {
var authProvider = getAuthProvider(configMap);
return authProvider.getEnabled();
return authProvider.getStates().stream()
.filter(SystemSetting.AuthProviderState::isEnabled)
.map(SystemSetting.AuthProviderState::getName)
.collect(Collectors.toSet());
})
.defaultIfEmpty(Set.of());
}
Expand All @@ -180,8 +184,8 @@ private static SystemSetting.AuthProvider getAuthProvider(ConfigMap configMap) {
authProvider = JsonUtils.jsonToObject(providerGroup, SystemSetting.AuthProvider.class);
}

if (authProvider.getEnabled() == null) {
authProvider.setEnabled(new HashSet<>());
if (authProvider.getStates() == null) {
authProvider.setStates(List.of());
}
return authProvider;
}
Expand Down

0 comments on commit 99fcfc1

Please sign in to comment.