1. 新增针对外部的自定义 sso 菜单外链
This commit is contained in:
@@ -218,16 +218,27 @@ public class ExternalSsoServiceImpl implements ExternalSsoService {
|
|||||||
if (strategies == null || strategies.isEmpty()) {
|
if (strategies == null || strategies.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return strategies.stream()
|
ExternalSsoStrategy wildcardStrategy = null;
|
||||||
.filter(strategy -> {
|
for (ExternalSsoStrategy strategy : strategies) {
|
||||||
try {
|
if (supportsSafely(strategy, sourceSystem)) {
|
||||||
return strategy.supports(sourceSystem);
|
return strategy;
|
||||||
} catch (Exception ex) {
|
}
|
||||||
log.warn("判定 SSO 策略是否支持来源系统时出现异常: {}", ex.getMessage());
|
if (wildcardStrategy == null && supportsSafely(strategy, null)) {
|
||||||
return false;
|
wildcardStrategy = strategy;
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
.findFirst()
|
return wildcardStrategy;
|
||||||
.orElse(null);
|
}
|
||||||
|
|
||||||
|
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