Skip to content

Commit bd6bc48

Browse files
committed
Merge branch 'master' into add-last-message-issue-instant
2 parents dae70f8 + 03aadbc commit bd6bc48

File tree

5 files changed

+150
-150
lines changed

5 files changed

+150
-150
lines changed

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

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,17 @@ public String getError() {
10231023
public Exception getValidationException() {
10241024
return validationException;
10251025
}
1026+
1027+
/**
1028+
* Sets the validation exception that this {@link SamlResponse} should return
1029+
* when a validation error occurs.
1030+
*
1031+
* @param validationException
1032+
* the validation exception to set
1033+
*/
1034+
protected void setValidationException(Exception validationException) {
1035+
this.validationException = validationException;
1036+
}
10261037

10271038
/**
10281039
* Extracts a node from the DOMDocument (Assertion).
@@ -1034,7 +1045,7 @@ public Exception getValidationException() {
10341045
* @throws XPathExpressionException
10351046
*
10361047
*/
1037-
private NodeList queryAssertion(String assertionXpath) throws XPathExpressionException {
1048+
protected NodeList queryAssertion(String assertionXpath) throws XPathExpressionException {
10381049
final String assertionExpr = "/saml:Assertion";
10391050
final String signatureExpr = "ds:Signature/ds:SignedInfo/ds:Reference";
10401051

@@ -1085,16 +1096,9 @@ private NodeList queryAssertion(String assertionXpath) throws XPathExpressionExc
10851096
*
10861097
* @return DOMNodeList The queried nodes
10871098
*/
1088-
private NodeList query(String nameQuery, Node context) throws XPathExpressionException {
1089-
Document doc;
1090-
if (encrypted) {
1091-
doc = decryptedDocument;
1092-
} else {
1093-
doc = samlResponseDocument;
1094-
}
1095-
1099+
protected NodeList query(String nameQuery, Node context) throws XPathExpressionException {
10961100
// LOGGER.debug("Executing query " + nameQuery);
1097-
return Util.query(doc, nameQuery, context);
1101+
return Util.query(getSAMLResponseDocument(), nameQuery, context);
10981102
}
10991103

11001104
/**

core/src/main/java/com/onelogin/saml2/logout/LogoutRequest.java

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,8 @@ public class LogoutRequest {
117117
* The NameID NameQualifier that will be set in the LogoutRequest.
118118
* @param nameIdSPNameQualifier
119119
* The SP Name Qualifier that will be set in the LogoutRequest.
120-
*
121-
* @throws XMLEntityException
122120
*/
123-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat, String nameIdNameQualifier, String nameIdSPNameQualifier) throws XMLEntityException {
121+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat, String nameIdNameQualifier, String nameIdSPNameQualifier) {
124122
this.settings = settings;
125123
this.request = request;
126124

@@ -165,10 +163,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
165163
* The nameIdFormat that will be set in the LogoutRequest.
166164
* @param nameIdNameQualifier
167165
* The NameID NameQualifier will be set in the LogoutRequest.
168-
*
169-
* @throws XMLEntityException
170166
*/
171-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat, String nameIdNameQualifier) throws XMLEntityException {
167+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat, String nameIdNameQualifier) {
172168
this(settings, request, nameId, sessionIndex, nameIdFormat, nameIdNameQualifier, null);
173169
}
174170

@@ -185,10 +181,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
185181
* The SessionIndex (taken from the SAML Response in the SSO process).
186182
* @param nameIdFormat
187183
* The nameIdFormat that will be set in the LogoutRequest.
188-
*
189-
* @throws XMLEntityException
190184
*/
191-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat) throws XMLEntityException {
185+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat) {
192186
this(settings, request, nameId, sessionIndex, nameIdFormat, null);
193187
}
194188

@@ -203,10 +197,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
203197
* The NameID that will be set in the LogoutRequest.
204198
* @param sessionIndex
205199
* The SessionIndex (taken from the SAML Response in the SSO process).
206-
*
207-
* @throws XMLEntityException
208200
*/
209-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex) throws XMLEntityException {
201+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex) {
210202
this(settings, request, nameId, sessionIndex, null);
211203
}
212204

@@ -215,10 +207,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
215207
*
216208
* @param settings
217209
* OneLogin_Saml2_Settings
218-
*
219-
* @throws XMLEntityException
220210
*/
221-
public LogoutRequest(Saml2Settings settings) throws XMLEntityException {
211+
public LogoutRequest(Saml2Settings settings) {
222212
this(settings, null, null, null);
223213
}
224214

@@ -228,11 +218,9 @@ public LogoutRequest(Saml2Settings settings) throws XMLEntityException {
228218
* @param settings
229219
* OneLogin_Saml2_Settings
230220
* @param request
231-
* the HttpRequest object to be processed (Contains GET and POST parameters, request URL, ...).
232-
*
233-
* @throws XMLEntityException
221+
* the HttpRequest object to be processed (Contains GET and POST parameters, request URL, ...).
234222
*/
235-
public LogoutRequest(Saml2Settings settings, HttpRequest request) throws XMLEntityException {
223+
public LogoutRequest(Saml2Settings settings, HttpRequest request) {
236224
this(settings, request, null, null);
237225
}
238226

@@ -360,14 +348,12 @@ private static StringBuilder getLogoutRequestTemplate() {
360348
return template;
361349
}
362350

363-
/**
364-
* Determines if the SAML LogoutRequest is valid or not
365-
*
366-
* @return true if the SAML LogoutRequest is valid
367-
*
368-
* @throws Exception
369-
*/
370-
public Boolean isValid() throws Exception {
351+
/**
352+
* Determines if the SAML LogoutRequest is valid or not
353+
*
354+
* @return true if the SAML LogoutRequest is valid
355+
*/
356+
public Boolean isValid() {
371357
validationException = null;
372358

373359
try {
@@ -796,6 +782,16 @@ public Exception getValidationException() {
796782
return validationException;
797783
}
798784

785+
/**
786+
* Sets the validation exception that this {@link LogoutRequest} should return
787+
* when a validation error occurs.
788+
*
789+
* @param validationException
790+
* the validation exception to set
791+
*/
792+
protected void setValidationException(Exception validationException) {
793+
this.validationException = validationException;
794+
}
799795

800796
/**
801797
* @return the ID of the Logout Request

core/src/main/java/com/onelogin/saml2/logout/LogoutResponse.java

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -338,14 +338,15 @@ public SamlResponseStatus getSamlResponseStatus() throws ValidationError
338338
}
339339

340340
/**
341-
* Extracts nodes that match the query from the DOMDocument (Logout Response Menssage)
342-
*
343-
* @param query
344-
* Xpath Expression
345-
*
346-
* @return DOMNodeList The queried nodes
347-
*/
348-
private NodeList query (String query) throws XPathExpressionException {
341+
* Extracts nodes that match the query from the DOMDocument (Logout Response Menssage)
342+
*
343+
* @param query
344+
* Xpath Expression
345+
*
346+
* @return DOMNodeList The queried nodes
347+
* @throws XPathExpressionException
348+
*/
349+
protected NodeList query (String query) throws XPathExpressionException {
349350
return Util.query(this.logoutResponseDocument, query, null);
350351
}
351352

@@ -476,6 +477,17 @@ public Exception getValidationException() {
476477
return validationException;
477478
}
478479

480+
/**
481+
* Sets the validation exception that this {@link LogoutResponse} should return
482+
* when a validation error occurs.
483+
*
484+
* @param validationException
485+
* the validation exception to set
486+
*/
487+
protected void setValidationException(Exception validationException) {
488+
this.validationException = validationException;
489+
}
490+
479491
/**
480492
* Returns the issue instant of this message.
481493
*

0 commit comments

Comments
 (0)