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
Redirect to relative subpath for approval, relative parent path on success #13569
Redirect to relative subpath for approval, relative parent path on success #13569
Conversation
pkg/auth/oauth/handlers/grant.go
Outdated
| reqURL := &(*req.URL) | ||
| reqURL.Host = "" | ||
| reqURL.Scheme = "" | ||
| reqURL.Path = path.Join("..", lastSegment) |
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.
Why go up a level and back down to the same level?
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.
gets rid of trailing slash
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.
Use path.Base or strings.TrimRight? Regardless, probably needs a comment.
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.
you misunderstand, it gets rid of the trailing slash in the browser... if you just redirect to ., you'd get /oauth/authorize/
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.
commented
| ), | ||
| ) | ||
| } | ||
| if strings.HasSuffix(url.Path, "/") { |
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.
These didn't work before either?
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.
they didn't work for grant approval flows (which realistically, no one hit before jenkins OAuth), they could have worked for /oauth/authorize proxying
|
[test] |
|
LGTM 👍 |
|
[merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/556/) (Base Commit: f0670df) (Image: devenv-rhel7_6115) |
|
Evaluated for origin merge up to f42b363 |
|
[test] |
|
Evaluated for origin test up to f42b363 |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/556/) (Base Commit: f0670df) |
This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…dentityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…ntityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…entityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…entityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…entityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…entityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
…entityProvider This change moves the docs away from the frontend based RequestHeaderIdentityProvider to the backend based BasicAuthPasswordIdentityProvider. This is because the LDAP docs assume a password based flow which requires the RequestHeaderIDP to support form based login. In 3.3 and earlier (before the grant approval flow existed), this form based login occurred in a single step that did not require a session. The grant flow changes this flow to require more than one step, necessitating the need for a session based approach. Apache does not have a form module that supports sessions, thus we cannot use the RequestHeaderIDP. By moving to the BasicAuthPasswordIDP, we leverage OpenShift's ability to manage sessions directly. This changes the network flow from: RequestHeaderIDP: User -> Apache -> OpenShift to: BasicAuthPasswordIDP: User -> OpenShift -> Apache From the perspective of Apache, the entire flow occurs in one step and thus Apache does not need to maintain a session. This allows users to continue to use their investment in SSSD and PAM to have a robust LDAP setup that supports automatic failover. There is no specific requirement on which PAM provider is used; these docs simply present one specific approach. This does have the negative side effect of making OpenShift see user's passwords. However, any individual that is concerned by this should instead use the RequestHeaderIdentityProvider with SAML and GSSAPI to eliminate the need for users to type passwords at all. This is required for OCP 3.4+ Fixes bug: Bug 1545548 Caused by fixing: Bug 1421629 Bug 1434983 Bug 1439221 Bug 1439222 via openshift/origin#13569 Signed-off-by: Monis Khan <mkhan@redhat.com>
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1434983
/oauth/approveto/oauth/authorize/approveLocation: authorize/approve)action="approve")Location: ../authorize)/and the proxy path not ending in/authorize)Tasks:
/oauth/authorizemust also proxy subpaths (notably/oauth/authorize/approve)/oauth/authorizemust end with.../authorize(with no trailing slash)