|
41 | 41 | import org.junit.Test;
|
42 | 42 | import org.junit.rules.ExpectedException;
|
43 | 43 | import org.opensaml.core.xml.XMLObject;
|
44 |
| -import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport; |
45 | 44 | import org.opensaml.core.xml.io.Marshaller;
|
46 | 45 | import org.opensaml.core.xml.io.MarshallingException;
|
47 | 46 | import org.opensaml.saml.common.assertion.ValidationContext;
|
48 | 47 | import org.opensaml.saml.saml2.core.Assertion;
|
49 | 48 | import org.opensaml.saml.saml2.core.AttributeStatement;
|
50 |
| -import org.opensaml.saml.saml2.core.AttributeValue; |
51 | 49 | import org.opensaml.saml.saml2.core.EncryptedAssertion;
|
52 | 50 | import org.opensaml.saml.saml2.core.EncryptedID;
|
53 | 51 | import org.opensaml.saml.saml2.core.NameID;
|
@@ -257,29 +255,6 @@ public void authenticateWhenAssertionContainsAttributesThenItSucceeds() {
|
257 | 255 | assertThat(principal.getAttributes()).isEqualTo(expected);
|
258 | 256 | }
|
259 | 257 |
|
260 |
| - @Test |
261 |
| - public void authenticateWhenAttributeValueMarshallerConfiguredThenUses() throws Exception { |
262 |
| - Response response = response(); |
263 |
| - Assertion assertion = assertion(); |
264 |
| - List<AttributeStatement> attributes = attributeStatements(); |
265 |
| - assertion.getAttributeStatements().addAll(attributes); |
266 |
| - signed(assertion, assertingPartySigningCredential(), RELYING_PARTY_ENTITY_ID); |
267 |
| - response.getAssertions().add(assertion); |
268 |
| - Saml2AuthenticationToken token = token(response, relyingPartyVerifyingCredential()); |
269 |
| - |
270 |
| - Element attributeElement = element("<element>value</element>"); |
271 |
| - Marshaller marshaller = mock(Marshaller.class); |
272 |
| - when(marshaller.marshall(any(XMLObject.class))).thenReturn(attributeElement); |
273 |
| - |
274 |
| - try { |
275 |
| - XMLObjectProviderRegistrySupport.getMarshallerFactory().registerMarshaller(AttributeValue.DEFAULT_ELEMENT_NAME, marshaller); |
276 |
| - this.provider.authenticate(token); |
277 |
| - verify(marshaller, atLeastOnce()).marshall(any(XMLObject.class)); |
278 |
| - } finally { |
279 |
| - XMLObjectProviderRegistrySupport.getMarshallerFactory().deregisterMarshaller(AttributeValue.DEFAULT_ELEMENT_NAME); |
280 |
| - } |
281 |
| - } |
282 |
| - |
283 | 258 | @Test
|
284 | 259 | public void authenticateWhenEncryptedAssertionWithoutSignatureThenItFails() throws Exception {
|
285 | 260 | this.exception.expect(authenticationMatcher(Saml2ErrorCodes.INVALID_SIGNATURE));
|
@@ -504,11 +479,4 @@ private Saml2AuthenticationToken token(String payload, Saml2X509Credential... cr
|
504 | 479 | return new Saml2AuthenticationToken(payload,
|
505 | 480 | DESTINATION, ASSERTING_PARTY_ENTITY_ID, RELYING_PARTY_ENTITY_ID, Arrays.asList(credentials));
|
506 | 481 | }
|
507 |
| - |
508 |
| - private static Element element(String xml) throws Exception { |
509 |
| - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
510 |
| - DocumentBuilder builder = factory.newDocumentBuilder(); |
511 |
| - Document doc = builder.parse(new InputSource(new StringReader(xml))); |
512 |
| - return doc.getDocumentElement(); |
513 |
| - } |
514 | 482 | }
|
0 commit comments