Skip to content

Commit 5e53592

Browse files
authored
Merge pull request #318 from mauromol/make-samlresponse-more-extensible
Make SamlResponse more extensible
2 parents 523786b + 93049ec commit 5e53592

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
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
/**

0 commit comments

Comments
 (0)