Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FederationResponse.idpURL(httpMethod == "POST"+ aSAMLRequestparam) and rewrite it to the SAML HTTP-Redirect (GET) binding, which the identity provider also accepts.SAMLRequestfrombase64(uncompressed XML)tobase64(raw-DEFLATE(XML))and form-urlencode the whole query so base64 characters (+/=) survive as%2B%2F%3D.usesPostBindingandisSAMLRequestcomputed properties onFederationResponseto make the branching explicit and testable.Context
idpURLalways built aGET-style URL and appendedrequestParamsas query items. For orgs whose IdP expects the SAML request via an HTTP formPOST(i.e. Microsoft Entra) the resulting URL is malformed and the IdP rejects it withAADSTS750056: SAMLRequest message was not properly base64-encoded, so federated sign-in never completes.This Pr is a initial draft on the Solution 2 from #4, we rebuild a compliant
GETrequest from the existingPOSTbased parameters if, and only if, theSAMLRequestparameter is present. This is to ensure that we do not break other nonSAML-based auth flows that do not require a reencode.I also added a custom form-urlencode based encoding step for the url parameters as this is the expected coding scheme for
SAMLGETurl parameters (for some reason) and decoding of some typically url allowed characters (i.e.+) break on ms entra side. For normal requests it should not matter, url encoding these characters is always possible just not required.Verification
Scope / limitations
This targets the specific case from #4 the
SAMLHTTP-POSTbinding and has so far only been tested with Microsoft Entra.It probably does not cover every
httpMethod == "POST"federated scenario.non-
SAMLPOSTflows are intentionally left as pass-through and are not converted. OtherSAMLIdPs that use thePOSTbinding should work (the conversion follows the standard redirect binding) but haven't been verified. Feedback from users on other identity providers would be welcome.Closes #4
Related: XcodesOrg/XcodesApp#857