Skip to content

Incorrect SSO URL construction #4

@xdgc

Description

@xdgc

The SSO URL constructor assumes the SSO base URL has no query. Patch below:

diff --git a/src/com/lastpass/jira/SAMLAuthenticator.java b/src/com/lastpass/jira/SAMLAuthenticator.java
index d2aa6ee..251deb5 100644
--- a/src/com/lastpass/jira/SAMLAuthenticator.java
+++ b/src/com/lastpass/jira/SAMLAuthenticator.java
@@ -128,8 +128,11 @@ public class SAMLAuthenticator extends JiraSeraphAuthenticator
         try {
             String authrequest = client.generateAuthnRequest(requestId);
             String url = client.getIdPConfig().getLoginUrl();
-            url = url +
-                "?SAMLRequest=" + URLEncoder.encode(authrequest, "UTF-8");
+            String sep = "?";
+            if (url.indexOf("?") > -1)
+                sep = "&";
+            url = url + sep +
+                "SAMLRequest=" + URLEncoder.encode(authrequest, "UTF-8");

             if (relayState != null)
                 url += "&RelayState=" + URLEncoder.encode(relayState, "UTF-8");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions