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.
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.
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.
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.
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?