Skip to content

Commit 385afcf

Browse files
committed
Set strict default value as true. Fix Travis. Update some dependencies
1 parent 4cd8543 commit 385afcf

File tree

9 files changed

+45
-27
lines changed

9 files changed

+45
-27
lines changed

.travis.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
language: java
2-
jdk:
3-
- openjdk7
4-
- openjdk8
5-
# - oraclejdk7 #It seems oraclejdk7 temp fail on Travis
2+
3+
matrix:
4+
include:
5+
- os: linux
6+
dist: trusty
7+
jdk: openjdk7
8+
- os: linux
9+
dist: precise
10+
jdk: oraclejdk7
11+
- os: linux
12+
ist: trusty
13+
jdk: openjdk8
14+
- os: linux
15+
dist: trusty
16+
jdk: oraclejdk8
17+
618
install: true
719
after_success:
820
- mvn clean verify org.jacoco:jacoco-maven-plugin:report org.eluder.coveralls:coveralls-maven-plugin:report

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
Add SAML support to your Java applications using this library.
66
Forget those complicated libraries and use that open source library provided and supported by OneLogin Inc.
77

8+
Version < 2.5.0 uses an old version of xmlsec library (<2.1.4 which has a security vulnerability [CVE-2019-12400](https://snyk.io/vuln/SNYK-JAVA-ORGAPACHESANTUARIO-460281))
9+
10+
Version 2.4.1 sets the 'strict' setting parameter to true.
11+
812
Version 2.X.X, compatible with java7 / java8.
913

1014
We [introduced some incompatibilities](https://github.com/onelogin/java-saml/issues/90), that could be fixed and make it compatible with java6.
@@ -188,7 +192,7 @@ Here are the list of properties to be defined on the settings file:
188192
# If 'strict' is True, then the Java Toolkit will reject unsigned
189193
# or unencrypted messages if it expects them signed or encrypted
190194
# Also will reject the messages if not strictly follow the SAML
191-
onelogin.saml2.strict = false
195+
onelogin.saml2.strict = true
192196

193197
# Enable debug mode (to print errors)
194198
onelogin.saml2.debug = false

core/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<dependency>
4949
<groupId>joda-time</groupId>
5050
<artifactId>joda-time</artifactId>
51-
<version>2.9.4</version>
51+
<version>2.10.3</version>
5252
</dependency>
5353

5454
<!-- commons -->
@@ -60,12 +60,12 @@
6060
<dependency>
6161
<groupId>org.apache.santuario</groupId>
6262
<artifactId>xmlsec</artifactId>
63-
<version>2.0.7</version>
63+
<version>2.0.9</version>
6464
</dependency>
6565
<dependency>
6666
<groupId>commons-codec</groupId>
6767
<artifactId>commons-codec</artifactId>
68-
<version>1.10</version>
68+
<version>1.12</version>
6969
</dependency>
7070
</dependencies>
7171

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class Saml2Settings {
3131
private static final Logger LOGGER = LoggerFactory.getLogger(Saml2Settings.class);
3232

3333
// Toolkit settings
34-
private boolean strict = false;
34+
private boolean strict = true;
3535
private boolean debug = false;
3636

3737
// SP

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ public void testGetNameIdNoKey() throws Exception {
364364
@Test
365365
public void testGetNameIdEmptyNameIDValue() throws Exception {
366366
Saml2Settings settings = new SettingsBuilder().fromFile("config/config.min.properties").build();
367+
settings.setStrict(false);
367368
String samlResponseEncoded = Util.getFileAsString("data/responses/invalids/empty_nameid.xml.base64");
368369
SamlResponse samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
369370
String nameId = samlResponse.getNameId();
@@ -499,6 +500,7 @@ public void testGetNameIdDataWrongSPNameQualifier() throws Exception {
499500
@Test
500501
public void testGetNameIdDataEmptyNameIDValue() throws Exception {
501502
Saml2Settings settings = new SettingsBuilder().fromFile("config/config.min.properties").build();
503+
settings.setStrict(false);
502504
String samlResponseEncoded = Util.getFileAsString("data/responses/invalids/empty_nameid.xml.base64");
503505
SamlResponse samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
504506
Map<String, String> nameIdData = samlResponse.getNameIdData();
@@ -2140,6 +2142,7 @@ public void testIsInValidEncIssues() throws IOException, Error, XPathExpressionE
21402142
@Test
21412143
public void testIsInValidCert() throws IOException, Error, XPathExpressionException, ParserConfigurationException, SAXException, SettingsException, ValidationError {
21422144
Saml2Settings settings = new SettingsBuilder().fromFile("config/config.invalididpcertstring.properties").build();
2145+
settings.setStrict(false);
21432146
String samlResponseEncoded = Util.getFileAsString("data/responses/valid_response.xml.base64");
21442147
SamlResponse samlResponse = new SamlResponse(settings, newHttpRequest(samlResponseEncoded));
21452148
assertFalse(samlResponse.isValid());

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ public class Saml2SettingsTest {
3838
@Test
3939
public void testIsStrict() {
4040
Saml2Settings settings = new Saml2Settings();
41-
42-
assertFalse(settings.isStrict());
43-
settings.setStrict(true);
41+
4442
assertTrue(settings.isStrict());
4543
settings.setStrict(false);
4644
assertFalse(settings.isStrict());
45+
settings.setStrict(true);
46+
assertTrue(settings.isStrict());
4747
}
4848

4949
/**

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void testLoadFromFileEmpty() throws IOException, CertificateException, UR
7676
Saml2Settings setting = new SettingsBuilder().fromFile("config/config.empty.properties").build();
7777

7878
assertFalse(setting.isDebugActive());
79-
assertFalse(setting.isStrict());
79+
assertTrue(setting.isStrict());
8080

8181
assertTrue(setting.getSpEntityId().isEmpty());
8282
assertNull(setting.getSpAssertionConsumerServiceUrl());
@@ -130,7 +130,7 @@ public void testLoadFromFileMinProp() throws IOException, CertificateException,
130130
Saml2Settings setting = new SettingsBuilder().fromFile("config/config.min.properties").build();
131131

132132
assertFalse(setting.isDebugActive());
133-
assertFalse(setting.isStrict());
133+
assertTrue(setting.isStrict());
134134

135135
assertEquals("http://localhost:8080/java-saml-jspsample/metadata.jsp", setting.getSpEntityId());
136136
assertEquals("http://localhost:8080/java-saml-jspsample/acs.jsp", setting.getSpAssertionConsumerServiceUrl().toString());
@@ -569,7 +569,7 @@ public void testFromProperties() throws IOException, Error, CertificateException
569569
Saml2Settings setting2 = new SettingsBuilder().fromProperties(prop).build();
570570

571571
assertFalse(setting2.isDebugActive());
572-
assertFalse(setting2.isStrict());
572+
assertTrue(setting2.isStrict());
573573

574574
assertEquals("http://localhost:8080/java-saml-jspsample/metadata.jsp", setting2.getSpEntityId());
575575
assertEquals("http://localhost:8080/java-saml-jspsample/acs.jsp", setting2.getSpAssertionConsumerServiceUrl().toString());

samples/java-saml-tookit-jspsample/src/main/resources/onelogin.saml.properties

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# If 'strict' is True, then the Java Toolkit will reject unsigned
22
# or unencrypted messages if it expects them signed or encrypted
33
# Also will reject the messages if not strictly follow the SAML
4-
onelogin.saml2.strict = false
4+
onelogin.saml2.strict = true
55

66
# Enable debug mode (to print errors)
77
onelogin.saml2.debug = false
@@ -42,41 +42,40 @@ onelogin.saml2.sp.nameidformat = urn:oasis:names:tc:SAML:1.1:nameid-format:unspe
4242

4343
onelogin.saml2.sp.x509cert =
4444

45-
# Requires Format PKCS#8 BEGIN PRIVATE KEY
45+
# Requires Format PKCS#8 BEGIN PRIVATE KEY
4646
# If you have PKCS#1 BEGIN RSA PRIVATE KEY convert it by openssl pkcs8 -topk8 -inform pem -nocrypt -in sp.rsa_key -outform pem -out sp.pem
4747
onelogin.saml2.sp.privatekey =
4848

4949
# Identity Provider Data that we want connect with our SP
5050
#
5151

5252
# Identifier of the IdP entity (must be a URI)
53-
onelogin.saml2.idp.entityid = https://app.onelogin.com/saml/metadata/672234
53+
onelogin.saml2.idp.entityid =
5454

5555
# SSO endpoint info of the IdP. (Authentication Request protocol)
5656
# URL Target of the IdP where the SP will send the Authentication Request Message
57-
onelogin.saml2.idp.single_sign_on_service.url = https://sgarcia-us-preprod.onelogin.com/trust/saml2/http-post/sso/672234
58-
57+
onelogin.saml2.idp.single_sign_on_service.url =
5958
# SAML protocol binding to be used when returning the <Response>
6059
# message. Onelogin Toolkit supports for this endpoint the
6160
# HTTP-Redirect binding only
6261
onelogin.saml2.idp.single_sign_on_service.binding = urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
6362

6463
# SLO endpoint info of the IdP.
6564
# URL Location of the IdP where the SP will send the SLO Request
66-
onelogin.saml2.idp.single_logout_service.url = https://sgarcia-us-preprod.onelogin.com/trust/saml2/http-redirect/slo/672234
65+
onelogin.saml2.idp.single_logout_service.url =
6766

6867
# Optional SLO Response endpoint info of the IdP.
6968
# URL Location of the IdP where the SP will send the SLO Response. If left blank, same URL as onelogin.saml2.idp.single_logout_service.url will be used.
7069
# Some IdPs use a separate URL for sending a logout request and response, use this property to set the separate response url
71-
onelogin.saml2.idp.single_logout_service.response.url = https://sgarcia-us-preprod.onelogin.com/trust/saml2/http-redirect/slo/672234
70+
onelogin.saml2.idp.single_logout_service.response.url =
7271

7372
# SAML protocol binding to be used when returning the <Response>
7473
# message. Onelogin Toolkit supports for this endpoint the
7574
# HTTP-Redirect binding only
7675
onelogin.saml2.idp.single_logout_service.binding = urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect
7776

7877
# Public x509 certificate of the IdP
79-
onelogin.saml2.idp.x509cert = -----BEGIN CERTIFICATE-----MIIGZTCCBE2gAwIBAgIULEW2UPHc+tQMo/j0NBM+8SbWK7IwDQYJKoZIhvcNAQELBQAwcjELMAkGA1UEBhMCVVMxKzApBgNVBAoMIk9uZUxvZ2luIFRlc3QgKHNnYXJjaWEtdXMtcHJlcHJvZCkxFTATBgNVBAsMDE9uZUxvZ2luIElkUDEfMB0GA1UEAwwWT25lTG9naW4gQWNjb3VudCA4OTE0NjAeFw0xNzA2MjAxMDA4MTla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hcmNpYS11cy1wcmVwcm9kKTEVMBMGA1UECwwMT25lTG9naW4gSWRQMR8wHQYDVQQDDBZPbmVMb2dpbiBBY2NvdW50IDg5MTQ2ghQsRbZQ8dz61Ayj+PQ0Ez7xJtYrsjAOBgNVHQ8BAf8EBAMCB4AwDQYJKoZIhvcNAQELBQADggIBAC2TQ4yqwk0ePey99JYI5PfMRVEnUyyCSPfKmyVJgoOZwk97+CZuq1MNqGavcExd1ofc4wkN3unk/g7qVRPBV24k9FZaicYrp5maSHakL2SJD8qo/deohYFaeH8RzszxEZbJJYMLiXyRJi44T28TyF8admIwUJVg/KBhNAHi/IlAsRWPL92nWJjSCBHgiPaG5HF10t/GaQSJuQpdhxniUlseuqXZ/Qm0MjAgSTlyaBIxLyOErrpVujwiR5RTHLw0wn+2P0WmfVp7e79GOqzFuwmoLfxUtJgalc7av9VwFdEB2nWF2hu7BwE9rzg8FTaw1uAEu+LQ++IUuI+ydparFWoo/IwtSrXF59mBoKMld58K4L+TfWwUYF3hAmH2XNiSBTFZn1HBsK+XqS1CUGD8R0WSVvQC2jjFbxztFkrOIzz5ITLzKcjr1E86r5PvBQXeeTvVz6g2L+wEA5VXGYh/RItHEkuwn7EPWpvJUfc5B0m57rfr0+UqWZaLbhczrmHFn0HaDXcs2ldi7y+Eiv6IP3vrJrHhdCDlVPLQH8w0f4vNcR8YYVOfWFHYzyo4oqRYFMRmoqfubs90zGLcB5ugm56k5VaseP+VGwjjTEyiD4CYPLEvKm0Z2M0L6MIkhp/9VYl8ZAWvPGKFMSaANkiMlux2uEBeG3s4nLQcunumphAo-----END CERTIFICATE-----
78+
onelogin.saml2.idp.x509cert =
8079

8180
# Instead of use the whole x509cert you can use a fingerprint
8281
# (openssl x509 -noout -fingerprint -in "idp.crt" to generate it,
@@ -156,4 +155,4 @@ onelogin.saml2.organization.lang =
156155
onelogin.saml2.contacts.technical.given_name = Technical Guy
157156
onelogin.saml2.contacts.technical.email_address = technical@example.com
158157
onelogin.saml2.contacts.support.given_name = Support Guy
159-
onelogin.saml2.contacts.support.email_address = support@@example.com
158+
onelogin.saml2.contacts.support.email_address = support@@example.com

toolkit/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
<dependency>
7070
<groupId>joda-time</groupId>
7171
<artifactId>joda-time</artifactId>
72-
<version>2.9.4</version>
72+
<version>2.10.3</version>
7373
</dependency>
7474

7575
<!-- commons -->
@@ -81,12 +81,12 @@
8181
<dependency>
8282
<groupId>org.apache.santuario</groupId>
8383
<artifactId>xmlsec</artifactId>
84-
<version>2.0.7</version>
84+
<version>2.0.9</version>
8585
</dependency>
8686
<dependency>
8787
<groupId>commons-codec</groupId>
8888
<artifactId>commons-codec</artifactId>
89-
<version>1.10</version>
89+
<version>1.12</version>
9090
</dependency>
9191
</dependencies>
9292

0 commit comments

Comments
 (0)