Skip to content

Commit 35ac1dd

Browse files
committed
Polish Formatting
Issue gh-10799
1 parent 1460d53 commit 35ac1dd

File tree

2 files changed

+45
-29
lines changed

2 files changed

+45
-29
lines changed

saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/core/TestSaml2X509Credentials.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public static Saml2X509Credential relyingPartyDecryptingCredential() {
6464
}
6565

6666
public static Saml2X509Credential altPublicCredential() {
67-
return new Saml2X509Credential(altCertificate(), Saml2X509CredentialType.VERIFICATION, Saml2X509CredentialType.ENCRYPTION);
67+
return new Saml2X509Credential(altCertificate(), Saml2X509CredentialType.VERIFICATION,
68+
Saml2X509CredentialType.ENCRYPTION);
6869
}
6970

7071
public static Saml2X509Credential altPrivateCredential() {
@@ -185,7 +186,7 @@ private static PrivateKey spPrivateKey() {
185186

186187
private static X509Certificate altCertificate() {
187188
return certificate(
188-
"-----BEGIN CERTIFICATE-----\n" + "MIICkDCCAfkCFEstVfmWSFQp/j88GaMUwqVK72adMA0GCSqGSIb3DQEBCwUAMIGG\n"
189+
"-----BEGIN CERTIFICATE-----\n" + "MIICkDCCAfkCFEstVfmWSFQp/j88GaMUwqVK72adMA0GCSqGSIb3DQEBCwUAMIGG\n"
189190
+ "MQswCQYDVQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjESMBAGA1UEBwwJVmFu\n"
190191
+ "Y291dmVyMR0wGwYDVQQKDBRTcHJpbmcgU2VjdXJpdHkgU0FNTDEMMAoGA1UECwwD\n"
191192
+ "YWx0MSEwHwYDVQQDDBhhbHQuc3ByaW5nLnNlY3VyaXR5LnNhbWwwHhcNMjIwMjEw\n"
@@ -203,7 +204,7 @@ private static X509Certificate altCertificate() {
203204

204205
private static PrivateKey altPrivateKey() {
205206
return privateKey(
206-
"-----BEGIN PRIVATE KEY-----\n" + "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAL1kZaNM8OzKZAIk\n"
207+
"-----BEGIN PRIVATE KEY-----\n" + "MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAL1kZaNM8OzKZAIk\n"
207208
+ "vTjinLjEuwEj9L1G/M15H2gP+0fKjEIT5hnON/Q/IG3CorOQpaoI9/hcZRgd8SmQ\n"
208209
+ "zmQljAJbxOw7Hl+fAshDB6I+qNisGv87QiMcypgb0eVH+uizuIG3hpsQZS78H3Ji\n"
209210
+ "DVhFg/EpDpM0/cAP720FPxOwUXKPAgMBAAECgYEApYKslAZ0cer5dSoYNzNLFOnQ\n"
@@ -215,8 +216,8 @@ private static PrivateKey altPrivateKey() {
215216
+ "DHV1LwJAW4xaV37Eo4z9B7Kr4Hzd1MA1ueW5QQDt+Q4vN/r7z4/1FHyFzh0Xcucd\n"
216217
+ "7nZX7qj0CkmgzOVG+Rb0P5LOxJA7gQJBAK1KQ2qNct375qPM9bEGSVGchH6k5X7+\n"
217218
+ "q4ztHdpFgTb/EzdbZiTG935GpjC1rwJuinTnrHOnkwv4j7iDRm24GF8CQQDqPvrQ\n"
218-
+ "GcItR6UUy0q/B8UxLzlE6t+HiznfiJKfyGgCHU56Y4/ZhzSQz2MZHz9SK4DsUL9s\n"
219-
+ "bOYrWq8VY2fyjV1t\n" + "-----END PRIVATE KEY-----");
219+
+ "GcItR6UUy0q/B8UxLzlE6t+HiznfiJKfyGgCHU56Y4/ZhzSQz2MZHz9SK4DsUL9s\n" + "bOYrWq8VY2fyjV1t\n"
220+
+ "-----END PRIVATE KEY-----");
220221
}
221222

222223
}

saml2/saml2-service-provider/src/test/java/org/springframework/security/saml2/provider/service/registration/RelyingPartyRegistrationTests.java

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -82,9 +82,9 @@ public void buildWhenUsingDefaultsThenAssertionConsumerServiceBindingDefaultsToP
8282
RelyingPartyRegistration relyingPartyRegistration = RelyingPartyRegistration.withRegistrationId("id")
8383
.entityId("entity-id").assertionConsumerServiceLocation("location")
8484
.assertingPartyDetails((assertingParty) -> assertingParty.entityId("entity-id")
85-
.singleSignOnServiceLocation("location")
86-
.verificationX509Credentials((c) -> c.add(TestSaml2X509Credentials.relyingPartyVerifyingCredential()))
87-
).build();
85+
.singleSignOnServiceLocation("location").verificationX509Credentials(
86+
(c) -> c.add(TestSaml2X509Credentials.relyingPartyVerifyingCredential())))
87+
.build();
8888
assertThat(relyingPartyRegistration.getAssertionConsumerServiceBinding()).isEqualTo(Saml2MessageBinding.POST);
8989
}
9090

@@ -99,36 +99,51 @@ public void buildPreservesCredentialsOrder() {
9999

100100
// Test with the alt credentials first
101101
RelyingPartyRegistration relyingPartyRegistration = TestRelyingPartyRegistrations.noCredentials()
102-
.assertingPartyDetails((assertingParty) -> assertingParty
103-
.verificationX509Credentials((c) -> { c.add(altApCredential); c.add(verifyingCredential); })
104-
.encryptionX509Credentials((c) -> { c.add(altApCredential); c.add(encryptingCredential); }))
105-
.signingX509Credentials(c -> { c.add(altRpCredential); c.add(signingCredential); })
106-
.decryptionX509Credentials(c -> { c.add(altRpCredential); c.add(decryptionCredential); })
107-
.build();
108-
assertThat(relyingPartyRegistration.getSigningX509Credentials())
109-
.containsExactly(altRpCredential, signingCredential);
110-
assertThat(relyingPartyRegistration.getDecryptionX509Credentials())
111-
.containsExactly(altRpCredential, decryptionCredential);
102+
.assertingPartyDetails((assertingParty) -> assertingParty.verificationX509Credentials((c) -> {
103+
c.add(altApCredential);
104+
c.add(verifyingCredential);
105+
}).encryptionX509Credentials((c) -> {
106+
c.add(altApCredential);
107+
c.add(encryptingCredential);
108+
})).signingX509Credentials((c) -> {
109+
c.add(altRpCredential);
110+
c.add(signingCredential);
111+
}).decryptionX509Credentials((c) -> {
112+
c.add(altRpCredential);
113+
c.add(decryptionCredential);
114+
}).build();
115+
assertThat(relyingPartyRegistration.getSigningX509Credentials()).containsExactly(altRpCredential,
116+
signingCredential);
117+
assertThat(relyingPartyRegistration.getDecryptionX509Credentials()).containsExactly(altRpCredential,
118+
decryptionCredential);
112119
assertThat(relyingPartyRegistration.getAssertingPartyDetails().getVerificationX509Credentials())
113120
.containsExactly(altApCredential, verifyingCredential);
114121
assertThat(relyingPartyRegistration.getAssertingPartyDetails().getEncryptionX509Credentials())
115122
.containsExactly(altApCredential, encryptingCredential);
116123

117124
// Test with the alt credentials last
118125
relyingPartyRegistration = TestRelyingPartyRegistrations.noCredentials()
119-
.assertingPartyDetails((assertingParty) -> assertingParty
120-
.verificationX509Credentials((c) -> { c.add(verifyingCredential); c.add(altApCredential); })
121-
.encryptionX509Credentials((c) -> { c.add(encryptingCredential); c.add(altApCredential); }))
122-
.signingX509Credentials(c -> { c.add(signingCredential); c.add(altRpCredential); })
123-
.decryptionX509Credentials(c -> { c.add(decryptionCredential); c.add(altRpCredential); })
124-
.build();
125-
assertThat(relyingPartyRegistration.getSigningX509Credentials())
126-
.containsExactly(signingCredential, altRpCredential);
127-
assertThat(relyingPartyRegistration.getDecryptionX509Credentials())
128-
.containsExactly(decryptionCredential, altRpCredential);
126+
.assertingPartyDetails((assertingParty) -> assertingParty.verificationX509Credentials((c) -> {
127+
c.add(verifyingCredential);
128+
c.add(altApCredential);
129+
}).encryptionX509Credentials((c) -> {
130+
c.add(encryptingCredential);
131+
c.add(altApCredential);
132+
})).signingX509Credentials((c) -> {
133+
c.add(signingCredential);
134+
c.add(altRpCredential);
135+
}).decryptionX509Credentials((c) -> {
136+
c.add(decryptionCredential);
137+
c.add(altRpCredential);
138+
}).build();
139+
assertThat(relyingPartyRegistration.getSigningX509Credentials()).containsExactly(signingCredential,
140+
altRpCredential);
141+
assertThat(relyingPartyRegistration.getDecryptionX509Credentials()).containsExactly(decryptionCredential,
142+
altRpCredential);
129143
assertThat(relyingPartyRegistration.getAssertingPartyDetails().getVerificationX509Credentials())
130144
.containsExactly(verifyingCredential, altApCredential);
131145
assertThat(relyingPartyRegistration.getAssertingPartyDetails().getEncryptionX509Credentials())
132146
.containsExactly(encryptingCredential, altApCredential);
133147
}
148+
134149
}

0 commit comments

Comments
 (0)