Skip to content

Commit 9c73ac1

Browse files
committed
WIP: Verify Metadata Signatures
This adds the RelyingPartyRegistrationsDecoder component which allows configuration with signature verification credentials. It also introduces a caching RelyingPartyRegistration implementation that uses it. Issue spring-projectsgh-12116
1 parent 8357b14 commit 9c73ac1

File tree

6 files changed

+171
-29
lines changed

6 files changed

+171
-29
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright 2002-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.security.saml2.provider.service.registration;
18+
19+
import java.io.InputStream;
20+
import java.util.HashMap;
21+
import java.util.Iterator;
22+
import java.util.Map;
23+
import java.util.concurrent.Callable;
24+
25+
import org.springframework.cache.Cache;
26+
import org.springframework.cache.concurrent.ConcurrentMapCache;
27+
import org.springframework.core.convert.converter.Converter;
28+
import org.springframework.core.io.DefaultResourceLoader;
29+
import org.springframework.core.io.ResourceLoader;
30+
import org.springframework.util.Assert;
31+
32+
public final class CachingRelyingPartyRegistrationRepository
33+
implements RelyingPartyRegistrationRepository, Iterable<RelyingPartyRegistration> {
34+
35+
private final ResourceLoader resourceLoader = new DefaultResourceLoader();
36+
37+
private final Callable<Map<String, RelyingPartyRegistration>> registrationLoader;
38+
39+
private Cache cache = new ConcurrentMapCache("registrations");
40+
41+
private Converter<RelyingPartyRegistration.Builder, RelyingPartyRegistration> relyingPartyRegistrationBuilder = RelyingPartyRegistration.Builder::build;
42+
43+
public CachingRelyingPartyRegistrationRepository(String metadataLocation,
44+
RelyingPartyRegistrationsDecoder decoder) {
45+
this.registrationLoader = () -> {
46+
Map<String, RelyingPartyRegistration> registrations = new HashMap<>();
47+
try (InputStream source = this.resourceLoader.getResource(metadataLocation).getInputStream()) {
48+
for (RelyingPartyRegistration registration : decoder.decode(source)) {
49+
registrations.put(registration.getRegistrationId(), registration);
50+
}
51+
return registrations;
52+
}
53+
};
54+
}
55+
56+
@Override
57+
public Iterator<RelyingPartyRegistration> iterator() {
58+
return registrations().values().iterator();
59+
}
60+
61+
@Override
62+
public RelyingPartyRegistration findByRegistrationId(String registrationId) {
63+
return registrations().get(registrationId);
64+
}
65+
66+
private Map<String, RelyingPartyRegistration> registrations() {
67+
return this.cache.get("registrations", this.registrationLoader);
68+
}
69+
70+
public void setCache(Cache cache) {
71+
Assert.notNull(cache, "cache cannot be null");
72+
this.cache = cache;
73+
}
74+
75+
}

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public class OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter
6262
OpenSamlInitializationService.initialize();
6363
}
6464

65-
private final OpenSamlMetadataRelyingPartyRegistrationConverter converter;
65+
private final OpenSamlRelyingPartyRegistrationsDecoder converter;
6666

6767
/**
6868
* Creates a {@link OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter}
6969
*/
7070
public OpenSamlRelyingPartyRegistrationBuilderHttpMessageConverter() {
71-
this.converter = new OpenSamlMetadataRelyingPartyRegistrationConverter();
71+
this.converter = new OpenSamlRelyingPartyRegistrationsDecoder();
7272
}
7373

7474
@Override
@@ -89,7 +89,7 @@ public List<MediaType> getSupportedMediaTypes() {
8989
@Override
9090
public RelyingPartyRegistration.Builder read(Class<? extends RelyingPartyRegistration.Builder> clazz,
9191
HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException {
92-
return this.converter.convert(inputMessage.getBody()).iterator().next();
92+
return this.converter.decode(inputMessage.getBody()).iterator().next().mutate();
9393
}
9494

9595
@Override
Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.Arrays;
2424
import java.util.Collection;
2525
import java.util.List;
26+
import java.util.Set;
2627

2728
import net.shibboleth.utilities.java.support.xml.ParserPool;
2829
import org.opensaml.core.config.ConfigurationService;
@@ -31,23 +32,34 @@
3132
import org.opensaml.core.xml.io.Unmarshaller;
3233
import org.opensaml.saml.common.xml.SAMLConstants;
3334
import org.opensaml.saml.ext.saml2alg.SigningMethod;
35+
import org.opensaml.saml.metadata.resolver.filter.MetadataFilter;
36+
import org.opensaml.saml.metadata.resolver.filter.MetadataFilterContext;
37+
import org.opensaml.saml.metadata.resolver.filter.impl.SignatureValidationFilter;
3438
import org.opensaml.saml.saml2.metadata.EntitiesDescriptor;
3539
import org.opensaml.saml.saml2.metadata.EntityDescriptor;
3640
import org.opensaml.saml.saml2.metadata.Extensions;
3741
import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
3842
import org.opensaml.saml.saml2.metadata.KeyDescriptor;
3943
import org.opensaml.saml.saml2.metadata.SingleLogoutService;
4044
import org.opensaml.saml.saml2.metadata.SingleSignOnService;
45+
import org.opensaml.security.credential.Credential;
46+
import org.opensaml.security.credential.CredentialResolver;
4147
import org.opensaml.security.credential.UsageType;
48+
import org.opensaml.security.credential.impl.CollectionCredentialResolver;
49+
import org.opensaml.xmlsec.config.impl.DefaultSecurityConfigurationBootstrap;
4250
import org.opensaml.xmlsec.keyinfo.KeyInfoSupport;
51+
import org.opensaml.xmlsec.signature.support.SignatureTrustEngine;
52+
import org.opensaml.xmlsec.signature.support.impl.ExplicitKeySignatureTrustEngine;
4353
import org.w3c.dom.Document;
4454
import org.w3c.dom.Element;
4555

56+
import org.springframework.core.convert.converter.Converter;
4657
import org.springframework.security.saml2.Saml2Exception;
4758
import org.springframework.security.saml2.core.OpenSamlInitializationService;
4859
import org.springframework.security.saml2.core.Saml2X509Credential;
60+
import org.springframework.util.Assert;
4961

50-
class OpenSamlMetadataRelyingPartyRegistrationConverter {
62+
public final class OpenSamlRelyingPartyRegistrationsDecoder implements RelyingPartyRegistrationsDecoder {
5163

5264
static {
5365
OpenSamlInitializationService.initialize();
@@ -57,12 +69,32 @@ class OpenSamlMetadataRelyingPartyRegistrationConverter {
5769

5870
private final ParserPool parserPool;
5971

72+
private final MetadataFilter filter;
73+
74+
private Converter<RelyingPartyRegistration.Builder, RelyingPartyRegistration> relyingPartyRegistrationBuilder = RelyingPartyRegistration.Builder::build;
75+
6076
/**
61-
* Creates a {@link OpenSamlMetadataRelyingPartyRegistrationConverter}
77+
* Creates a {@link OpenSamlRelyingPartyRegistrationsDecoder}
6278
*/
63-
OpenSamlMetadataRelyingPartyRegistrationConverter() {
79+
public OpenSamlRelyingPartyRegistrationsDecoder() {
80+
this((xmlObject, metadataFilterContent) -> xmlObject);
81+
}
82+
83+
public OpenSamlRelyingPartyRegistrationsDecoder(Set<Credential> verificationCredentials) {
84+
this(metadataFilter(verificationCredentials));
85+
}
86+
87+
static MetadataFilter metadataFilter(Set<Credential> credentials) {
88+
CredentialResolver credentialsResolver = new CollectionCredentialResolver(credentials);
89+
SignatureTrustEngine engine = new ExplicitKeySignatureTrustEngine(credentialsResolver,
90+
DefaultSecurityConfigurationBootstrap.buildBasicInlineKeyInfoCredentialResolver());
91+
return new SignatureValidationFilter(engine);
92+
}
93+
94+
OpenSamlRelyingPartyRegistrationsDecoder(MetadataFilter filter) {
6495
this.registry = ConfigurationService.get(XMLObjectProviderRegistry.class);
6596
this.parserPool = this.registry.getParserPool();
97+
this.filter = filter;
6698
}
6799

68100
OpenSamlRelyingPartyRegistration.Builder convert(EntityDescriptor descriptor) {
@@ -152,24 +184,25 @@ else if (singleLogoutService.getBinding().equals(Saml2MessageBinding.REDIRECT.ge
152184
return builder;
153185
}
154186

155-
Collection<RelyingPartyRegistration.Builder> convert(InputStream inputStream) {
156-
List<RelyingPartyRegistration.Builder> builders = new ArrayList<>();
187+
@Override
188+
public Collection<RelyingPartyRegistration> decode(InputStream inputStream) {
189+
List<RelyingPartyRegistration> registrations = new ArrayList<>();
157190
XMLObject xmlObject = xmlObject(inputStream);
158191
if (xmlObject instanceof EntitiesDescriptor) {
159192
EntitiesDescriptor descriptors = (EntitiesDescriptor) xmlObject;
160193
for (EntityDescriptor descriptor : descriptors.getEntityDescriptors()) {
161194
if (descriptor.getIDPSSODescriptor(SAMLConstants.SAML20P_NS) != null) {
162-
builders.add(convert(descriptor));
195+
registrations.add(this.relyingPartyRegistrationBuilder.convert(convert(descriptor)));
163196
}
164197
}
165-
if (builders.isEmpty()) {
198+
if (registrations.isEmpty()) {
166199
throw new Saml2Exception("Metadata contains no IDPSSODescriptor elements");
167200
}
168-
return builders;
201+
return registrations;
169202
}
170203
if (xmlObject instanceof EntityDescriptor) {
171204
EntityDescriptor descriptor = (EntityDescriptor) xmlObject;
172-
return Arrays.asList(convert(descriptor));
205+
return Arrays.asList(this.relyingPartyRegistrationBuilder.convert(convert(descriptor)));
173206
}
174207
throw new Saml2Exception("Unsupported element of type " + xmlObject.getClass());
175208
}
@@ -202,7 +235,7 @@ private XMLObject xmlObject(InputStream inputStream) {
202235
throw new Saml2Exception("Unsupported element of type " + element.getTagName());
203236
}
204237
try {
205-
return unmarshaller.unmarshall(element);
238+
return this.filter.filter(unmarshaller.unmarshall(element), new MetadataFilterContext());
206239
}
207240
catch (Exception ex) {
208241
throw new Saml2Exception(ex);
@@ -225,4 +258,10 @@ private <T> List<T> signingMethods(Extensions extensions) {
225258
return new ArrayList<>();
226259
}
227260

261+
public void setRelyingPartyRegistrationBuilder(
262+
Converter<RelyingPartyRegistration.Builder, RelyingPartyRegistration> relyingPartyRegistrationBuilder) {
263+
Assert.notNull(relyingPartyRegistrationBuilder, "relyingPartyRegistrationBuilder cannot be null");
264+
this.relyingPartyRegistrationBuilder = relyingPartyRegistrationBuilder;
265+
}
266+
228267
}

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrations.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.io.IOException;
2020
import java.io.InputStream;
21+
import java.util.ArrayList;
2122
import java.util.Collection;
2223

2324
import org.springframework.core.io.DefaultResourceLoader;
@@ -34,7 +35,7 @@
3435
*/
3536
public final class RelyingPartyRegistrations {
3637

37-
private static final OpenSamlMetadataRelyingPartyRegistrationConverter relyingPartyRegistrationConverter = new OpenSamlMetadataRelyingPartyRegistrationConverter();
38+
private static final OpenSamlRelyingPartyRegistrationsDecoder relyingPartyRegistrationConverter = new OpenSamlRelyingPartyRegistrationsDecoder();
3839

3940
private static final ResourceLoader resourceLoader = new DefaultResourceLoader();
4041

@@ -213,7 +214,11 @@ public static Collection<RelyingPartyRegistration.Builder> collectionFromMetadat
213214
* @since 5.7
214215
*/
215216
public static Collection<RelyingPartyRegistration.Builder> collectionFromMetadata(InputStream source) {
216-
return relyingPartyRegistrationConverter.convert(source);
217+
Collection<RelyingPartyRegistration.Builder> builders = new ArrayList<>();
218+
for (RelyingPartyRegistration registration : relyingPartyRegistrationConverter.decode(source)) {
219+
builders.add(registration.mutate());
220+
}
221+
return builders;
217222
}
218223

219224
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2002-2024 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.security.saml2.provider.service.registration;
18+
19+
import java.io.InputStream;
20+
import java.util.Collection;
21+
22+
public interface RelyingPartyRegistrationsDecoder {
23+
24+
Collection<RelyingPartyRegistration> decode(InputStream entities);
25+
26+
}
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import static org.assertj.core.api.Assertions.assertThat;
3838
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
3939

40-
public class OpenSamlMetadataRelyingPartyRegistrationConverterTests {
40+
public class OpenSamlRelyingPartyRegistrationsDecoderTests {
4141

4242
private static final String CERTIFICATE = "MIIEEzCCAvugAwIBAgIJAIc1qzLrv+5nMA0GCSqGSIb3DQEBCwUAMIGfMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ08xFDASBgNVBAcMC0Nhc3RsZSBSb2NrMRwwGgYDVQQKDBNTYW1sIFRlc3RpbmcgU2VydmVyMQswCQYDVQQLDAJJVDEgMB4GA1UEAwwXc2ltcGxlc2FtbHBocC5jZmFwcHMuaW8xIDAeBgkqhkiG9w0BCQEWEWZoYW5pa0BwaXZvdGFsLmlvMB4XDTE1MDIyMzIyNDUwM1oXDTI1MDIyMjIyNDUwM1owgZ8xCzAJBgNVBAYTAlVTMQswCQYDVQQIDAJDTzEUMBIGA1UEBwwLQ2FzdGxlIFJvY2sxHDAaBgNVBAoME1NhbWwgVGVzdGluZyBTZXJ2ZXIxCzAJBgNVBAsMAklUMSAwHgYDVQQDDBdzaW1wbGVzYW1scGhwLmNmYXBwcy5pbzEgMB4GCSqGSIb3DQEJARYRZmhhbmlrQHBpdm90YWwuaW8wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC4cn62E1xLqpN34PmbrKBbkOXFjzWgJ9b+pXuaRft6A339uuIQeoeH5qeSKRVTl32L0gdz2ZivLwZXW+cqvftVW1tvEHvzJFyxeTW3fCUeCQsebLnA2qRa07RkxTo6Nf244mWWRDodcoHEfDUSbxfTZ6IExSojSIU2RnD6WllYWFdD1GFpBJOmQB8rAc8wJIBdHFdQnX8Ttl7hZ6rtgqEYMzYVMuJ2F2r1HSU1zSAvwpdYP6rRGFRJEfdA9mm3WKfNLSc5cljz0X/TXy0vVlAV95l9qcfFzPmrkNIst9FZSwpvB49LyAVke04FQPPwLgVH4gphiJH3jvZ7I+J5lS8VAgMBAAGjUDBOMB0GA1UdDgQWBBTTyP6Cc5HlBJ5+ucVCwGc5ogKNGzAfBgNVHSMEGDAWgBTTyP6Cc5HlBJ5+ucVCwGc5ogKNGzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQAvMS4EQeP/ipV4jOG5lO6/tYCb/iJeAduOnRhkJk0DbX329lDLZhTTL/x/w/9muCVcvLrzEp6PN+VWfw5E5FWtZN0yhGtP9R+vZnrV+oc2zGD+no1/ySFOe3EiJCO5dehxKjYEmBRv5sU/LZFKZpozKN/BMEa6CqLuxbzb7ykxVr7EVFXwltPxzE9TmL9OACNNyF5eJHWMRMllarUvkcXlh4pux4ks9e6zV9DQBy2zds9f1I3qxg0eX6JnGrXi/ZiCT+lJgVe3ZFXiejiLAiKB04sXW3ti0LW3lx13Y1YlQ4/tlpgTgfIJxKV6nyPiLoK0nywbMd+vpAirDt2Oc+hk";
4343

@@ -62,7 +62,7 @@ public class OpenSamlMetadataRelyingPartyRegistrationConverterTests {
6262
private static final String SINGLE_SIGN_ON_SERVICE_TEMPLATE = "<md:SingleSignOnService Binding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect\" "
6363
+ "Location=\"sso-location\"/>";
6464

65-
private OpenSamlMetadataRelyingPartyRegistrationConverter converter = new OpenSamlMetadataRelyingPartyRegistrationConverter();
65+
private OpenSamlRelyingPartyRegistrationsDecoder converter = new OpenSamlRelyingPartyRegistrationsDecoder();
6666

6767
private String metadata;
6868

@@ -78,8 +78,8 @@ public void setup() throws Exception {
7878
@Test
7979
public void convertWhenDefaultsThenAssertingPartyInstanceOfOpenSaml() throws Exception {
8080
try (InputStream source = new ByteArrayInputStream(this.metadata.getBytes(StandardCharsets.UTF_8))) {
81-
this.converter.convert(source)
82-
.forEach((registration) -> assertThat(registration.build().getAssertingPartyDetails())
81+
this.converter.decode(source)
82+
.forEach((registration) -> assertThat(registration.getAssertingPartyDetails())
8383
.isInstanceOf(OpenSamlAssertingPartyDetails.class));
8484
}
8585
}
@@ -88,15 +88,15 @@ public void convertWhenDefaultsThenAssertingPartyInstanceOfOpenSaml() throws Exc
8888
public void readWhenMissingIDPSSODescriptorThenException() {
8989
String payload = String.format(ENTITY_DESCRIPTOR_TEMPLATE, "");
9090
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
91-
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.convert(inputStream))
91+
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.decode(inputStream))
9292
.withMessageContaining("Metadata response is missing the necessary IDPSSODescriptor element");
9393
}
9494

9595
@Test
9696
public void readWhenMissingVerificationKeyThenException() {
9797
String payload = String.format(ENTITY_DESCRIPTOR_TEMPLATE, String.format(IDP_SSO_DESCRIPTOR_TEMPLATE, ""));
9898
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
99-
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.convert(inputStream))
99+
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.decode(inputStream))
100100
.withMessageContaining(
101101
"Metadata response is missing verification certificates, necessary for verifying SAML assertions");
102102
}
@@ -106,7 +106,7 @@ public void readWhenMissingSingleSignOnServiceThenException() {
106106
String payload = String.format(ENTITY_DESCRIPTOR_TEMPLATE,
107107
String.format(IDP_SSO_DESCRIPTOR_TEMPLATE, String.format(KEY_DESCRIPTOR_TEMPLATE, "use=\"signing\"")));
108108
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
109-
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.convert(inputStream))
109+
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.decode(inputStream))
110110
.withMessageContaining(
111111
"Metadata response is missing a SingleSignOnService, necessary for sending AuthnRequests");
112112
}
@@ -119,10 +119,9 @@ public void readWhenDescriptorFullySpecifiedThenConfigures() throws Exception {
119119
+ String.format(KEY_DESCRIPTOR_TEMPLATE, "use=\"encryption\"") + EXTENSIONS_TEMPLATE
120120
+ String.format(SINGLE_SIGN_ON_SERVICE_TEMPLATE)));
121121
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
122-
RelyingPartyRegistration.AssertingPartyDetails details = this.converter.convert(inputStream)
122+
RelyingPartyRegistration.AssertingPartyDetails details = this.converter.decode(inputStream)
123123
.iterator()
124124
.next()
125-
.build()
126125
.getAssertingPartyDetails();
127126
assertThat(details.getWantAuthnRequestsSigned()).isFalse();
128127
assertThat(details.getSigningAlgorithms()).containsExactly(SignatureConstants.ALGO_ID_DIGEST_SHA512);
@@ -152,10 +151,9 @@ public void readWhenEntitiesDescriptorThenConfigures() throws Exception {
152151
+ String.format(KEY_DESCRIPTOR_TEMPLATE, "use=\"encryption\"")
153152
+ String.format(SINGLE_SIGN_ON_SERVICE_TEMPLATE))));
154153
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
155-
RelyingPartyRegistration.AssertingPartyDetails details = this.converter.convert(inputStream)
154+
RelyingPartyRegistration.AssertingPartyDetails details = this.converter.decode(inputStream)
156155
.iterator()
157156
.next()
158-
.build()
159157
.getAssertingPartyDetails();
160158
assertThat(details.getWantAuthnRequestsSigned()).isFalse();
161159
assertThat(details.getSingleSignOnServiceLocation()).isEqualTo("sso-location");
@@ -174,10 +172,9 @@ public void readWhenKeyDescriptorHasNoUseThenConfiguresBothKeyTypes() throws Exc
174172
String payload = String.format(ENTITY_DESCRIPTOR_TEMPLATE, String.format(IDP_SSO_DESCRIPTOR_TEMPLATE,
175173
String.format(KEY_DESCRIPTOR_TEMPLATE, "") + String.format(SINGLE_SIGN_ON_SERVICE_TEMPLATE)));
176174
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
177-
RelyingPartyRegistration.AssertingPartyDetails details = this.converter.convert(inputStream)
175+
RelyingPartyRegistration.AssertingPartyDetails details = this.converter.decode(inputStream)
178176
.iterator()
179177
.next()
180-
.build()
181178
.getAssertingPartyDetails();
182179
assertThat(details.getVerificationX509Credentials().iterator().next().getCertificate())
183180
.isEqualTo(x509Certificate(CERTIFICATE));
@@ -201,7 +198,7 @@ X509Certificate x509Certificate(String data) {
201198
public void readWhenUnsupportedElementThenSaml2Exception() {
202199
String payload = "<saml2:Assertion xmlns:saml2=\"https://some.endpoint\"/>";
203200
InputStream inputStream = new ByteArrayInputStream(payload.getBytes());
204-
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.convert(inputStream))
201+
assertThatExceptionOfType(Saml2Exception.class).isThrownBy(() -> this.converter.decode(inputStream))
205202
.withMessage("Unsupported element of type saml2:Assertion");
206203
}
207204

0 commit comments

Comments
 (0)