-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix google idp saml redirect url #6451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
|
Kudos, SonarCloud Quality Gate passed! |
| } | ||
| if (idpMetadata.getEntityId().startsWith("https://accounts.google.com/o/saml2?idpid=")) { | ||
| redirectUrl = idpMetadata.getSsoUrl() + SAMLUtils.generateSAMLRequestSignature(SAMLUtils.encodeSAMLRequest(authnRequest), privateKey, signatureAlgorithm); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need an else block here? Otherwise the redirectUrl will be overridden on the next line
|
Thanks @neogismm can you please rebase and target the PR to the 4.17 branch? |
| if (spMetadata.getKeyPair() != null) { | ||
| privateKey = spMetadata.getKeyPair().getPrivate(); | ||
| } | ||
| if (idpMetadata.getEntityId().startsWith("https://accounts.google.com/o/saml2?idpid=")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use URIBuilder instead, https://hc.apache.org/httpcomponents-core-5.1.x/5.1.1/httpcore5/apidocs/org/apache/hc/core5/net/URIBuilder.html
... or similar that helps generate the url based on a base URL and query params.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or search for ? in the idp entity url and based on that use correct concatenation strategy? (+ plus add unit tests)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
searching for ? in the IdP url should be sufficient, since we only care about appending the SAML request query param to the URL.
|
Closing this PR as @Luis-3M's PR has a better solution and also includes the tests. |








Fixes #6427
This PR fixes the redirect URL for SAML authentication while using Google as IdP.
Note: I could not test my fix because choosing google as idp for a user requires the SSO url which also contains the unique IDP id created by google.
Example:
SSO URL: https://accounts.google.com/o/saml2/idp?dpid={IDP-ID}
Entity ID: https://accounts.google.com/o/saml2?idpid={IDP-ID}
To set up a custom google saml app requires a google workspace account which was not possible for me to create at the moment.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?