Skip to content

Commit 6589f28

Browse files
committed
Make SamlResponse more extensible
The query and queryAssertion methods are really useful when creating extensions of SamlResponse that need to expose other information that the plain java-saml library does not (like the response issue instant, or any custom contents of the AuthnContext in the assertion auth statement). Having these two methods private forces the extender to reimplement them from scratch, probably by copy-and-paste, which is clearly sub-optimal.
1 parent 523786b commit 6589f28

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ public Exception getValidationException() {
10331033
* @throws XPathExpressionException
10341034
*
10351035
*/
1036-
private NodeList queryAssertion(String assertionXpath) throws XPathExpressionException {
1036+
protected NodeList queryAssertion(String assertionXpath) throws XPathExpressionException {
10371037
final String assertionExpr = "/saml:Assertion";
10381038
final String signatureExpr = "ds:Signature/ds:SignedInfo/ds:Reference";
10391039

@@ -1084,16 +1084,9 @@ private NodeList queryAssertion(String assertionXpath) throws XPathExpressionExc
10841084
*
10851085
* @return DOMNodeList The queried nodes
10861086
*/
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-
1087+
protected NodeList query(String nameQuery, Node context) throws XPathExpressionException {
10951088
// LOGGER.debug("Executing query " + nameQuery);
1096-
return Util.query(doc, nameQuery, context);
1089+
return Util.query(getSAMLResponseDocument(), nameQuery, context);
10971090
}
10981091

10991092
/**

0 commit comments

Comments
 (0)