Merge remote-tracking branch 'base-version/main' into dev
# Conflicts: # zt-dependencies/pom.xml # zt-module-system/zt-module-system-server/src/main/java/com/zt/plat/module/system/service/sso/ExternalSsoServiceImpl.java
This commit is contained in:
@@ -218,16 +218,27 @@ public class ExternalSsoServiceImpl implements ExternalSsoService {
|
||||
if (strategies == null || strategies.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return strategies.stream()
|
||||
.filter(strategy -> {
|
||||
try {
|
||||
return strategy.supports(sourceSystem);
|
||||
} catch (Exception ex) {
|
||||
log.warn("判定 SSO 策略是否支持来源系统时出现异常: {}", ex.getMessage());
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
ExternalSsoStrategy wildcardStrategy = null;
|
||||
for (ExternalSsoStrategy strategy : strategies) {
|
||||
if (supportsSafely(strategy, sourceSystem)) {
|
||||
return strategy;
|
||||
}
|
||||
if (wildcardStrategy == null && supportsSafely(strategy, null)) {
|
||||
wildcardStrategy = strategy;
|
||||
}
|
||||
}
|
||||
return wildcardStrategy;
|
||||
}
|
||||
|
||||
private boolean supportsSafely(ExternalSsoStrategy strategy, String sourceSystem) {
|
||||
try {
|
||||
return strategy.supports(sourceSystem);
|
||||
} catch (Exception ex) {
|
||||
if (log.isWarnEnabled()) {
|
||||
log.warn("判定 SSO 策略 [{}] 是否支持来源系统 [{}] 时出现异常: {}",
|
||||
strategy.getClass().getSimpleName(), sourceSystem, ex.getMessage());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user