Skip to content

Commit 52fb638

Browse files
committed
Some comments and support for saml2 and samlp2 prefix
1 parent 5d37bd1 commit 52fb638

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

src/main/java/com/onelogin/saml/Response.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,31 @@ public class Response {
4343

4444
private static final Logger log = LoggerFactory.getLogger(Response.class);
4545

46+
/**
47+
* Simple constructor, when you use this constructor you should call this methods before validate saml response:
48+
* loadXmlFromBase64(response);
49+
* setDestinationUrl(currentUrl)
50+
*
51+
* @param accountSettings Object with idp information
52+
*
53+
*/
4654
public Response(AccountSettings accountSettings) throws CertificateException {
4755
error = new StringBuffer();
4856
this.accountSettings = accountSettings;
4957
}
5058

51-
public Response(AccountSettings accountSettings, String response) throws Exception {
59+
/**
60+
* Constructor to have a Response object full builded and ready to validate the saml response
61+
*
62+
* @param accountSettings Object with idp information
63+
* @param response SAML Response on string format
64+
* @param currentURL URL of the current host + current view
65+
*/
66+
67+
public Response(AccountSettings accountSettings, String response, String currentURL) throws Exception {
5268
this(accountSettings);
5369
loadXmlFromBase64(response);
70+
this.currentUrl = currentURL;
5471
}
5572

5673
public void loadXmlFromBase64(String responseStr) throws Exception {

src/main/java/com/onelogin/saml/Utils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public static NodeList query(Document dom, String query, Node context)
7373

7474
public String getNamespaceURI(String prefix) {
7575
String result = null;
76-
if (prefix.equals("samlp"))
76+
if (prefix.equals("samlp") || prefix.equals("samlp2"))
7777
result = Constants.NS_SAMLP;
78-
else if (prefix.equals("saml"))
78+
else if (prefix.equals("saml") || prefix.equals("saml2"))
7979
result = Constants.NS_SAML;
8080
else if (prefix.equals("ds"))
8181
result = Constants.NS_DS;

0 commit comments

Comments
 (0)