Skip to content

Commit 0f53b87

Browse files
anderson.martinsanderson.martins
authored andcommitted
Be able to register multiple Identity Provider x509cert
1 parent 20778d8 commit 0f53b87

File tree

11 files changed

+540
-75
lines changed

11 files changed

+540
-75
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,14 @@ You should be able to workaround this by configuring your server so that it is a
548548
For Apache Tomcat this is done by setting the proxyName, proxyPort, scheme and secure attributes for the Connector. See [here](http://serverfault.com/questions/774300/ssl-offloading-from-apache-to-tomcat-get-overwritten-somewhere) for an example.
549549

550550

551+
### IdP with multiple certificates
552+
553+
In some scenarios the IdP uses different certificates for
554+
signing/encryption, or is under key rollover phase and more than one certificate is published on IdP metadata.
555+
556+
In order to handle that the toolkit offers the `onelogin.saml2.idp.x509certMulti` parameters where you can set additional certificates that will be used to validate IdP signature. However just the certificate setted in `onelogin.saml2.idp.x509cert` parameter will be used for encrypting.
557+
558+
551559
### Replay attacks
552560

553561
In order to avoid replay attacks, you can store the ID of the SAML messages already processed, to avoid processing them twice. Since the Messages expires and will be invalidated due that fact, you don't need to store those IDs longer than the time frame that you currently accepting.

core/src/main/java/com/onelogin/saml2/authn/SamlResponse.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,16 @@ public boolean isValid(String requestId) {
293293
if (signedElements.isEmpty() || (!hasSignedAssertion && !hasSignedResponse)) {
294294
throw new ValidationError("No Signature found. SAML Response rejected", ValidationError.NO_SIGNATURE_FOUND);
295295
} else {
296-
X509Certificate cert = settings.getIdpx509cert();
296+
List<X509Certificate> certList = settings.getIdpx509certMulti();
297297
String fingerprint = settings.getIdpCertFingerprint();
298298
String alg = settings.getIdpCertFingerprintAlgorithm();
299299

300-
if (hasSignedResponse && !Util.validateSign(samlResponseDocument, cert, fingerprint, alg, Util.RESPONSE_SIGNATURE_XPATH)) {
300+
if (hasSignedResponse && !Util.validateSign(samlResponseDocument, certList, fingerprint, alg, Util.RESPONSE_SIGNATURE_XPATH)) {
301301
throw new ValidationError("Signature validation failed. SAML Response rejected", ValidationError.INVALID_SIGNATURE);
302302
}
303303

304304
final Document documentToCheckAssertion = encrypted ? decryptedDocument : samlResponseDocument;
305-
if (hasSignedAssertion && !Util.validateSign(documentToCheckAssertion, cert, fingerprint, alg, Util.ASSERTION_SIGNATURE_XPATH)) {
305+
if (hasSignedAssertion && !Util.validateSign(documentToCheckAssertion, certList, fingerprint, alg, Util.ASSERTION_SIGNATURE_XPATH)) {
306306
throw new ValidationError("Signature validation failed. SAML Response rejected", ValidationError.INVALID_SIGNATURE);
307307
}
308308
}

core/src/main/java/com/onelogin/saml2/settings/Saml2Settings.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class Saml2Settings {
5252
private URL idpSingleLogoutServiceResponseUrl = null;
5353
private String idpSingleLogoutServiceBinding = Constants.BINDING_HTTP_REDIRECT;
5454
private X509Certificate idpx509cert = null;
55+
private List<X509Certificate> idpx509certMulti = null;
5556
private String idpCertFingerprint = null;
5657
private String idpCertFingerprintAlgorithm = "sha1";
5758

@@ -212,6 +213,13 @@ public final String getIdpCertFingerprintAlgorithm() {
212213
return idpCertFingerprintAlgorithm;
213214
}
214215

216+
/**
217+
* @return the idpx509certMulti setting value
218+
*/
219+
public List<X509Certificate> getIdpx509certMulti() {
220+
return idpx509certMulti;
221+
}
222+
215223
/**
216224
* @return the nameIdEncrypted setting value
217225
*/
@@ -522,6 +530,15 @@ protected final void setIdpCertFingerprintAlgorithm(String idpCertFingerprintAlg
522530
this.idpCertFingerprintAlgorithm = idpCertFingerprintAlgorithm;
523531
}
524532

533+
/**
534+
* Set the idpx509certMulti setting value
535+
*
536+
* @param idpx509certMulti the idpx509certMulti to set
537+
*/
538+
public void setIdpx509certMulti(List<X509Certificate> idpx509certMulti) {
539+
this.idpx509certMulti= idpx509certMulti;
540+
}
541+
525542
/**
526543
* Set the nameIdEncrypted setting value
527544
*

core/src/main/java/com/onelogin/saml2/settings/SettingsBuilder.java

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import java.security.PrivateKey;
88
import java.security.cert.CertificateException;
99
import java.security.cert.X509Certificate;
10+
import java.util.ArrayList;
1011
import java.util.Arrays;
1112
import java.util.LinkedHashMap;
1213
import java.util.LinkedList;
@@ -67,6 +68,7 @@ public class SettingsBuilder {
6768
public final static String IDP_SINGLE_LOGOUT_SERVICE_BINDING_PROPERTY_KEY = "onelogin.saml2.idp.single_logout_service.binding";
6869

6970
public final static String IDP_X509CERT_PROPERTY_KEY = "onelogin.saml2.idp.x509cert";
71+
public final static String IDP_X509CERTMULTI_PROPERTY_KEY = "onelogin.saml2.idp.x509certMulti";
7072
public final static String CERTFINGERPRINT_PROPERTY_KEY = "onelogin.saml2.idp.certfingerprint";
7173
public final static String CERTFINGERPRINT_ALGORITHM_PROPERTY_KEY = "onelogin.saml2.idp.certfingerprint_algorithm";
7274

@@ -222,9 +224,15 @@ private void loadIdpSetting() {
222224
if (idpSingleLogoutServiceBinding != null)
223225
saml2Setting.setIdpSingleLogoutServiceBinding(idpSingleLogoutServiceBinding);
224226

227+
List<X509Certificate> idpX509certMulti = loadCertificateListFromProp(IDP_X509CERTMULTI_PROPERTY_KEY);
228+
if (idpX509certMulti != null)
229+
saml2Setting.setIdpx509certMulti(idpX509certMulti);
230+
225231
X509Certificate idpX509cert = loadCertificateFromProp(IDP_X509CERT_PROPERTY_KEY);
226-
if (idpX509cert != null)
232+
if (idpX509cert != null) {
227233
saml2Setting.setIdpx509cert(idpX509cert);
234+
idpX509certMulti.add(0, idpX509cert);
235+
}
228236

229237
String idpCertFingerprint = loadStringProperty(CERTFINGERPRINT_PROPERTY_KEY);
230238
if (idpCertFingerprint != null)
@@ -485,15 +493,14 @@ private URL loadURLProperty(String propertyKey) {
485493
}
486494

487495
/**
488-
* Loads a property of the type X509Certificate from the Properties object
496+
* Loads a property of the type X509Certificate from the property value
489497
*
490-
* @param propertyKey
491-
* the property name
498+
* @param propValue
499+
* the property value
492500
*
493501
* @return the X509Certificate object
494502
*/
495-
protected X509Certificate loadCertificateFromProp(String propertyKey) {
496-
Object propValue = samlData.get(propertyKey);
503+
protected X509Certificate loadCertificateFromProp(Object propValue) {
497504

498505
if (isString(propValue)) {
499506
try {
@@ -511,6 +518,42 @@ protected X509Certificate loadCertificateFromProp(String propertyKey) {
511518
return null;
512519
}
513520

521+
/**
522+
* Loads a property of the type X509Certificate from the Properties object
523+
*
524+
* @param propertyKey
525+
* the property name
526+
*
527+
* @return the X509Certificate object
528+
*/
529+
protected X509Certificate loadCertificateFromProp(String propertyKey) {
530+
return loadCertificateFromProp(samlData.get(propertyKey));
531+
}
532+
533+
/**
534+
* Loads a property of the type List of X509Certificate from the Properties object
535+
*
536+
* @param propertyKey
537+
* the property name
538+
*
539+
* @return the X509Certificate object list
540+
*/
541+
private List<X509Certificate> loadCertificateListFromProp(String propertyKey) {
542+
List<X509Certificate> list = new ArrayList<X509Certificate>();
543+
544+
int i = 0;
545+
while (true) {
546+
Object propValue = samlData.get(propertyKey + "." + i++);
547+
548+
if (propValue == null)
549+
break;
550+
551+
list.add(loadCertificateFromProp(propValue));
552+
}
553+
554+
return list;
555+
}
556+
514557
/**
515558
* Loads a property of the type X509Certificate from file
516559
*

core/src/main/java/com/onelogin/saml2/util/Util.java

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.security.spec.PKCS8EncodedKeySpec;
3030
import java.util.Calendar;
3131
import java.util.Iterator;
32+
import java.util.List;
3233
import java.util.Locale;
3334
import java.util.TimeZone;
3435
import java.util.UUID;
@@ -852,6 +853,39 @@ public static boolean validateSign(final Document doc, final X509Certificate cer
852853
}
853854
return false;
854855
}
856+
857+
/**
858+
* Validate the signature pointed to by the xpath
859+
*
860+
* @param doc The document we should validate
861+
* @param certs The public certificates
862+
* @param fingerprint The fingerprint of the public certificate
863+
* @param alg The signature algorithm method
864+
* @param xpath the xpath of the ds:Signture node to validate
865+
*
866+
* @return True if the signature exists and is valid, false otherwise.
867+
*/
868+
public static boolean validateSign(final Document doc, final List<X509Certificate> certList, final String fingerprint,
869+
final String alg, final String xpath) {
870+
try {
871+
final NodeList signatures = query(doc, xpath);
872+
873+
if (signatures.getLength() == 1) {
874+
final Node signNode = signatures.item(0);
875+
if (certList == null || certList.isEmpty()) {
876+
return validateSignNode(signNode, null, fingerprint, alg);
877+
} else {
878+
for (X509Certificate cert : certList) {
879+
if (validateSignNode(signNode, cert, fingerprint, alg))
880+
return true;
881+
}
882+
}
883+
}
884+
} catch (XPathExpressionException e) {
885+
LOGGER.warn("Failed to find signature nodes", e);
886+
}
887+
return false;
888+
}
855889

856890
/**
857891
* Validate signature (Metadata).

core/src/test/java/com/onelogin/saml2/test/authn/AuthnResponseTest.java

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,57 @@ public void testIsValidSign() throws IOException, Error, XPathExpressionExceptio
23002300
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
23012301
assertTrue(samlResponse.isValid());
23022302
}
2303+
2304+
/**
2305+
* Tests the isValid method of SamlResponse with idpx509certMulti
2306+
* Case: valid sign response / sign assertion / both signed
2307+
*
2308+
* @throws ValidationError
2309+
* @throws SettingsException
2310+
* @throws IOException
2311+
* @throws SAXException
2312+
* @throws ParserConfigurationException
2313+
* @throws XPathExpressionException
2314+
* @throws Error
2315+
*
2316+
* @see com.onelogin.saml2.authn.SamlResponse#isValid
2317+
*/
2318+
@Test
2319+
public void testIsValidSignWithCertMulti() throws IOException, Error, XPathExpressionException, ParserConfigurationException, SAXException, SettingsException, ValidationError {
2320+
Saml2Settings settings = new SettingsBuilder().fromFile("config/config.mywithmulticert.properties").build();
2321+
settings.setWantAssertionsSigned(false);
2322+
settings.setWantMessagesSigned(false);
2323+
String samlResponseEncoded = Util.getFileAsString("data/responses/signed_message_response.xml.base64");
2324+
2325+
settings.setStrict(false);
2326+
SamlResponse samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2327+
assertTrue(samlResponse.isValid());
2328+
2329+
settings.setStrict(true);
2330+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2331+
assertTrue(samlResponse.isValid());
2332+
2333+
samlResponseEncoded = Util.getFileAsString("data/responses/signed_assertion_response.xml.base64");
2334+
2335+
settings.setStrict(false);
2336+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2337+
assertTrue(samlResponse.isValid());
2338+
2339+
settings.setStrict(true);
2340+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2341+
assertTrue(samlResponse.isValid());
2342+
2343+
samlResponseEncoded = Util.getFileAsString("data/responses/double_signed_response.xml.base64");
2344+
2345+
settings.setStrict(false);
2346+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2347+
assertTrue(samlResponse.isValid());
2348+
2349+
settings.setStrict(true);
2350+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2351+
assertTrue(samlResponse.isValid());
2352+
}
2353+
23032354

23042355
/**
23052356
* Tests the processSignedElements method of SamlResponse
@@ -2506,6 +2557,75 @@ public void testIsInValidSign() throws IOException, Error, XPathExpressionExcept
25062557
assertFalse(samlResponse.isValid());
25072558
assertEquals("Found an invalid Signed Element. SAML Response rejected", samlResponse.getError());
25082559
}
2560+
2561+
2562+
2563+
/**
2564+
* Tests the isValid method of SamlResponse with Idpx509certMulti
2565+
* Case: invalid signs
2566+
*
2567+
* @throws ValidationError
2568+
* @throws SettingsException
2569+
* @throws IOException
2570+
* @throws SAXException
2571+
* @throws ParserConfigurationException
2572+
* @throws XPathExpressionException
2573+
* @throws Error
2574+
*
2575+
* @see com.onelogin.saml2.authn.SamlResponse#isValid
2576+
*/
2577+
@Test
2578+
public void testIsInValidSignWithCertMulti() throws IOException, Error, XPathExpressionException, ParserConfigurationException, SAXException, SettingsException, ValidationError {
2579+
Saml2Settings settings = new SettingsBuilder().fromFile("config/config.min.properties").build();
2580+
settings.setStrict(true);
2581+
String samlResponseEncoded = Util.getFileAsString("data/responses/unsigned_response.xml.base64");
2582+
2583+
SamlResponse samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2584+
assertFalse(samlResponse.isValid());
2585+
assertEquals("No Signature found. SAML Response rejected", samlResponse.getError());
2586+
2587+
settings = new SettingsBuilder().fromFile("config/config.mywithmulticert.properties").build();
2588+
2589+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/triple_signed_response.xml.base64");
2590+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2591+
assertFalse(samlResponse.isValid());
2592+
assertEquals("Duplicated ID. SAML Response rejected", samlResponse.getError());
2593+
2594+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/signed_assertion_response_with_2signatures.xml.base64");
2595+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2596+
assertFalse(samlResponse.isValid());
2597+
assertEquals("Duplicated ID. SAML Response rejected", samlResponse.getError());
2598+
2599+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/signed_message_response_with_2signatures.xml.base64");
2600+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2601+
assertFalse(samlResponse.isValid());
2602+
assertEquals("Duplicated ID. SAML Response rejected", samlResponse.getError());
2603+
2604+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/wrong_signed_element.xml.base64");
2605+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2606+
assertFalse(samlResponse.isValid());
2607+
assertEquals("Invalid Signature Element {urn:oasis:names:tc:SAML:2.0:assertion}Subject SAML Response rejected", samlResponse.getError());
2608+
2609+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/wrong_signed_element2.xml.base64");
2610+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2611+
assertFalse(samlResponse.isValid());
2612+
assertEquals("Invalid Signature Element {urn:oasis:names:tc:SAML:2.0:assertion}Subject SAML Response rejected", samlResponse.getError());
2613+
2614+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/duplicate_reference_uri.xml.base64");
2615+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2616+
assertFalse(samlResponse.isValid());
2617+
assertEquals("Found an invalid Signed Element. SAML Response rejected", samlResponse.getError());
2618+
2619+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/no_assertion_id.xml.base64");
2620+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2621+
assertFalse(samlResponse.isValid());
2622+
assertEquals("Signed Element must contain an ID. SAML Response rejected", samlResponse.getError());
2623+
2624+
samlResponseEncoded = Util.getFileAsString("data/responses/invalids/bad_reference.xml.base64");
2625+
samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
2626+
assertFalse(samlResponse.isValid());
2627+
assertEquals("Found an invalid Signed Element. SAML Response rejected", samlResponse.getError());
2628+
}
25092629

25102630
/**
25112631
* Tests the validateSignedElements method of SamlResponse

core/src/test/java/com/onelogin/saml2/test/settings/SettingBuilderTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,8 @@ public void testLoadFromValues() throws Exception {
619619
samlData.put(IDP_SINGLE_LOGOUT_SERVICE_BINDING_PROPERTY_KEY, "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect");
620620
samlData.put(IDP_SINGLE_LOGOUT_SERVICE_RESPONSE_URL_PROPERTY_KEY, "http://idp.example.com/simplesaml/saml2/idp/SingleLogoutServiceResponse.php");
621621
samlData.put(IDP_X509CERT_PROPERTY_KEY, "-----BEGIN CERTIFICATE-----\nMIIBrTCCAaGgAwIBAgIBATADBgEAMGcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRUwEwYDVQQHDAxTYW50YSBNb25pY2ExETAPBgNVBAoMCE9uZUxv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/mvlbOn+sNZE+VZ1AntYuG8ekbJpJtG1YfRfc7EA9mEtqvv4dhv7zBy4nK49OR+KpIBjItWB5kYvrqMLKBa32sMbgqqUqeF1ENXKjpvLSuPdfGJZA3dNa/+Dyb8GGqWe707zLyc5F8m\n-----END CERTIFICATE-----");
622624
samlData.put(CERTFINGERPRINT_PROPERTY_KEY, "4b6f70bb2cab82c86a8270f71a880b62e25bc2b3");
623625
samlData.put(CERTFINGERPRINT_ALGORITHM_PROPERTY_KEY, "sha1");
624626

@@ -673,6 +675,14 @@ public void testLoadFromValues() throws Exception {
673675
assertEquals(setting.getIdpSingleLogoutServiceBinding(), "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect");
674676
assertNotNull(setting.getIdpx509cert());
675677
assertEquals(Util.loadCert(Util.getFileAsString("certs/certificate1")), setting.getIdpx509cert());
678+
assertNotNull(setting.getIdpx509certMulti());
679+
assertEquals(setting.getIdpx509certMulti().size(), 3);
680+
assertNotNull(setting.getIdpx509certMulti().get(0));
681+
assertEquals(Util.loadCert(Util.getFileAsString("certs/certificate1")), setting.getIdpx509certMulti().get(0));
682+
assertNotNull(setting.getIdpx509certMulti().get(1));
683+
assertEquals(Util.loadCert(Util.getFileAsString("certs/certificate2")), setting.getIdpx509certMulti().get(1));
684+
assertNotNull(setting.getIdpx509certMulti().get(2));
685+
assertEquals(Util.loadCert(Util.getFileAsString("certs/certificate3")), setting.getIdpx509certMulti().get(2));
676686
assertEquals("4b6f70bb2cab82c86a8270f71a880b62e25bc2b3", setting.getIdpCertFingerprint());
677687
assertEquals("sha1", setting.getIdpCertFingerprintAlgorithm());
678688

0 commit comments

Comments
 (0)