Merge branch '6.4.x'
CI / Build (17, ubuntu-latest) (push) Has been cancelled
Details
CI / Build (17, windows-latest) (push) Has been cancelled
Details
CI / Test Against Snapshots (17, 17) (push) Has been cancelled
Details
CI / Test Against Snapshots (21-ea, 21) (push) Has been cancelled
Details
CI / Check Samples (push) Has been cancelled
Details
Deploy Docs / build (push) Has been cancelled
Details
Execute Gradle Wrapper Upgrade / Execution (push) Has been cancelled
Details
CI / Deploy Artifacts (push) Has been cancelled
Details
CI / Deploy Docs (push) Has been cancelled
Details
CI / Deploy Schema (push) Has been cancelled
Details
CI / Perform Release (push) Has been cancelled
Details
CI / Send Notification (push) Has been cancelled
Details
CI / Build (17, ubuntu-latest) (push) Has been cancelled
Details
CI / Build (17, windows-latest) (push) Has been cancelled
Details
CI / Test Against Snapshots (17, 17) (push) Has been cancelled
Details
CI / Test Against Snapshots (21-ea, 21) (push) Has been cancelled
Details
CI / Check Samples (push) Has been cancelled
Details
Deploy Docs / build (push) Has been cancelled
Details
Execute Gradle Wrapper Upgrade / Execution (push) Has been cancelled
Details
CI / Deploy Artifacts (push) Has been cancelled
Details
CI / Deploy Docs (push) Has been cancelled
Details
CI / Deploy Schema (push) Has been cancelled
Details
CI / Perform Release (push) Has been cancelled
Details
CI / Send Notification (push) Has been cancelled
Details
This commit is contained in:
commit
9df3a57d9e
|
@ -166,7 +166,7 @@ class BaseOpenSamlAuthenticationProvider implements AuthenticationProvider {
|
|||
String inResponseTo = response.getInResponseTo();
|
||||
result = result.concat(validateInResponseTo(token.getAuthenticationRequest(), inResponseTo));
|
||||
|
||||
String issuer = response.getIssuer().getValue();
|
||||
String issuer = issuer(response);
|
||||
String destination = response.getDestination();
|
||||
String location = token.getRelyingPartyRegistration().getAssertionConsumerServiceLocation();
|
||||
if (StringUtils.hasText(destination) && !destination.equals(location)) {
|
||||
|
@ -189,6 +189,13 @@ class BaseOpenSamlAuthenticationProvider implements AuthenticationProvider {
|
|||
};
|
||||
}
|
||||
|
||||
private static String issuer(Response response) {
|
||||
if (response.getIssuer() == null) {
|
||||
return null;
|
||||
}
|
||||
return response.getIssuer().getValue();
|
||||
}
|
||||
|
||||
static List<String> getStatusCodes(Response response) {
|
||||
if (response.getStatus() == null) {
|
||||
return List.of(StatusCode.SUCCESS);
|
||||
|
@ -314,7 +321,7 @@ class BaseOpenSamlAuthenticationProvider implements AuthenticationProvider {
|
|||
}
|
||||
|
||||
private void process(Saml2AuthenticationToken token, Response response) {
|
||||
String issuer = response.getIssuer().getValue();
|
||||
String issuer = issuer(response);
|
||||
this.logger.debug(LogMessage.format("Processing SAML response from %s", issuer));
|
||||
boolean responseSigned = response.isSigned();
|
||||
|
||||
|
|
|
@ -889,6 +889,15 @@ public class OpenSaml4AuthenticationProviderTests {
|
|||
provider.authenticate(token);
|
||||
}
|
||||
|
||||
// gh-16989
|
||||
@Test
|
||||
public void authenticateWhenNullIssuerThenNoNullPointer() {
|
||||
OpenSaml4AuthenticationProvider provider = new OpenSaml4AuthenticationProvider();
|
||||
Response response = TestOpenSamlObjects.signedResponseWithOneAssertion((r) -> r.setIssuer(null));
|
||||
Saml2AuthenticationToken token = token(response, verifying(registration()));
|
||||
assertThatExceptionOfType(Saml2AuthenticationException.class).isThrownBy(() -> provider.authenticate(token));
|
||||
}
|
||||
|
||||
private <T extends XMLObject> T build(QName qName) {
|
||||
return (T) XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName).buildObject(qName);
|
||||
}
|
||||
|
|
|
@ -975,6 +975,15 @@ public class OpenSaml5AuthenticationProviderTests {
|
|||
provider.authenticate(token);
|
||||
}
|
||||
|
||||
// gh-16989
|
||||
@Test
|
||||
public void authenticateWhenNullIssuerThenNoNullPointer() {
|
||||
OpenSaml5AuthenticationProvider provider = new OpenSaml5AuthenticationProvider();
|
||||
Response response = TestOpenSamlObjects.signedResponseWithOneAssertion((r) -> r.setIssuer(null));
|
||||
Saml2AuthenticationToken token = token(response, verifying(registration()));
|
||||
assertThatExceptionOfType(Saml2AuthenticationException.class).isThrownBy(() -> provider.authenticate(token));
|
||||
}
|
||||
|
||||
private <T extends XMLObject> T build(QName qName) {
|
||||
return (T) XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName).buildObject(qName);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue