mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-07 11:12:14 +00:00
Improve OpenSAML Version Check
Closes gh-10077
This commit is contained in:
parent
dfebd6d9d4
commit
ba16d91971
@ -260,8 +260,17 @@ public final class Saml2LoginConfigurer<B extends HttpSecurityBuilder<B>>
|
|||||||
return this.authenticationConverter;
|
return this.authenticationConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String version() {
|
||||||
|
String version = Version.getVersion();
|
||||||
|
if (version != null) {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
return Version.class.getModule().getDescriptor().version().map(Object::toString)
|
||||||
|
.orElseThrow(() -> new IllegalStateException("cannot determine OpenSAML version"));
|
||||||
|
}
|
||||||
|
|
||||||
private void registerDefaultAuthenticationProvider(B http) {
|
private void registerDefaultAuthenticationProvider(B http) {
|
||||||
if (Version.getVersion().startsWith("4")) {
|
if (version().startsWith("4")) {
|
||||||
http.authenticationProvider(postProcess(new OpenSaml4AuthenticationProvider()));
|
http.authenticationProvider(postProcess(new OpenSaml4AuthenticationProvider()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -346,7 +355,7 @@ public final class Saml2LoginConfigurer<B extends HttpSecurityBuilder<B>>
|
|||||||
private Saml2AuthenticationRequestFactory getResolver(B http) {
|
private Saml2AuthenticationRequestFactory getResolver(B http) {
|
||||||
Saml2AuthenticationRequestFactory resolver = getSharedOrBean(http, Saml2AuthenticationRequestFactory.class);
|
Saml2AuthenticationRequestFactory resolver = getSharedOrBean(http, Saml2AuthenticationRequestFactory.class);
|
||||||
if (resolver == null) {
|
if (resolver == null) {
|
||||||
if (Version.getVersion().startsWith("4")) {
|
if (version().startsWith("4")) {
|
||||||
return new OpenSaml4AuthenticationRequestFactory();
|
return new OpenSaml4AuthenticationRequestFactory();
|
||||||
}
|
}
|
||||||
return new OpenSamlAuthenticationRequestFactory();
|
return new OpenSamlAuthenticationRequestFactory();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user