Skip to content

Commit ecb21f6

Browse files
committed
Merge branch 'master' into clarify-relaystate-parameter
2 parents 88ffba6 + 03aadbc commit ecb21f6

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
@@ -1022,6 +1022,17 @@ public String getError() {
10221022
public Exception getValidationException() {
10231023
return validationException;
10241024
}
1025+
1026+
/**
1027+
* Sets the validation exception that this {@link SamlResponse} should return
1028+
* when a validation error occurs.
1029+
*
1030+
* @param validationException
1031+
* the validation exception to set
1032+
*/
1033+
protected void setValidationException(Exception validationException) {
1034+
this.validationException = validationException;
1035+
}
10251036

10261037
/**
10271038
* Extracts a node from the DOMDocument (Assertion).
@@ -1033,7 +1044,7 @@ public Exception getValidationException() {
10331044
* @throws XPathExpressionException
10341045
*
10351046
*/
1036-
private NodeList queryAssertion(String assertionXpath) throws XPathExpressionException {
1047+
protected NodeList queryAssertion(String assertionXpath) throws XPathExpressionException {
10371048
final String assertionExpr = "/saml:Assertion";
10381049
final String signatureExpr = "ds:Signature/ds:SignedInfo/ds:Reference";
10391050

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

10991103
/**

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

@@ -163,10 +161,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
163161
* The nameIdFormat that will be set in the LogoutRequest.
164162
* @param nameIdNameQualifier
165163
* The NameID NameQualifier will be set in the LogoutRequest.
166-
*
167-
* @throws XMLEntityException
168164
*/
169-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat, String nameIdNameQualifier) throws XMLEntityException {
165+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat, String nameIdNameQualifier) {
170166
this(settings, request, nameId, sessionIndex, nameIdFormat, nameIdNameQualifier, null);
171167
}
172168

@@ -183,10 +179,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
183179
* The SessionIndex (taken from the SAML Response in the SSO process).
184180
* @param nameIdFormat
185181
* The nameIdFormat that will be set in the LogoutRequest.
186-
*
187-
* @throws XMLEntityException
188182
*/
189-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat) throws XMLEntityException {
183+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex, String nameIdFormat) {
190184
this(settings, request, nameId, sessionIndex, nameIdFormat, null);
191185
}
192186

@@ -201,10 +195,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
201195
* The NameID that will be set in the LogoutRequest.
202196
* @param sessionIndex
203197
* The SessionIndex (taken from the SAML Response in the SSO process).
204-
*
205-
* @throws XMLEntityException
206198
*/
207-
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex) throws XMLEntityException {
199+
public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId, String sessionIndex) {
208200
this(settings, request, nameId, sessionIndex, null);
209201
}
210202

@@ -213,10 +205,8 @@ public LogoutRequest(Saml2Settings settings, HttpRequest request, String nameId,
213205
*
214206
* @param settings
215207
* OneLogin_Saml2_Settings
216-
*
217-
* @throws XMLEntityException
218208
*/
219-
public LogoutRequest(Saml2Settings settings) throws XMLEntityException {
209+
public LogoutRequest(Saml2Settings settings) {
220210
this(settings, null, null, null);
221211
}
222212

@@ -226,11 +216,9 @@ public LogoutRequest(Saml2Settings settings) throws XMLEntityException {
226216
* @param settings
227217
* OneLogin_Saml2_Settings
228218
* @param request
229-
* the HttpRequest object to be processed (Contains GET and POST parameters, request URL, ...).
230-
*
231-
* @throws XMLEntityException
219+
* the HttpRequest object to be processed (Contains GET and POST parameters, request URL, ...).
232220
*/
233-
public LogoutRequest(Saml2Settings settings, HttpRequest request) throws XMLEntityException {
221+
public LogoutRequest(Saml2Settings settings, HttpRequest request) {
234222
this(settings, request, null, null);
235223
}
236224

@@ -358,14 +346,12 @@ private static StringBuilder getLogoutRequestTemplate() {
358346
return template;
359347
}
360348

361-
/**
362-
* Determines if the SAML LogoutRequest is valid or not
363-
*
364-
* @return true if the SAML LogoutRequest is valid
365-
*
366-
* @throws Exception
367-
*/
368-
public Boolean isValid() throws Exception {
349+
/**
350+
* Determines if the SAML LogoutRequest is valid or not
351+
*
352+
* @return true if the SAML LogoutRequest is valid
353+
*/
354+
public Boolean isValid() {
369355
validationException = null;
370356

371357
try {
@@ -758,6 +744,16 @@ public Exception getValidationException() {
758744
return validationException;
759745
}
760746

747+
/**
748+
* Sets the validation exception that this {@link LogoutRequest} should return
749+
* when a validation error occurs.
750+
*
751+
* @param validationException
752+
* the validation exception to set
753+
*/
754+
protected void setValidationException(Exception validationException) {
755+
this.validationException = validationException;
756+
}
761757

762758
/**
763759
* @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

@@ -475,4 +476,15 @@ public String getError() {
475476
public Exception getValidationException() {
476477
return validationException;
477478
}
479+
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+
}
478490
}

0 commit comments

Comments
 (0)