1
0
mirror of synced 2026-05-22 21:33:16 +00:00

Add Factor Tests for Authentication Providers

Issue gh-17933
This commit is contained in:
Josh Cummings
2025-09-18 15:38:39 -06:00
parent 39e2bb67fc
commit 758b35df9c
9 changed files with 158 additions and 0 deletions
@@ -985,6 +985,14 @@ public class OpenSaml5AuthenticationProviderTests {
assertThatExceptionOfType(Saml2AuthenticationException.class).isThrownBy(() -> provider.authenticate(token));
}
@Test
public void authenticateWhenSuccessThenIssuesFactor() {
Response response = TestOpenSamlObjects.signedResponseWithOneAssertion();
Authentication request = token(response, verifying(registration()));
Authentication result = this.provider.authenticate(request);
SecurityAssertions.assertThat(result).hasAuthority("FACTOR_SAML_RESPONSE");
}
private <T extends XMLObject> T build(QName qName) {
return (T) XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(qName).buildObject(qName);
}