Skip to content
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

Merged
merged 2 commits into from Apr 4, 2017
Merged

Redirect to relative subpath for approval, relative parent path on success #13569

merged 2 commits into from Apr 4, 2017

Conversation

liggitt
Copy link
Contributor

@liggitt liggitt commented Mar 29, 2017

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1434983

  • Moves grant approval endpoint from /oauth/approve to /oauth/authorize/approve
  • Changes the redirect to the grant approval flow to be a relative path redirect (Location: authorize/approve)
  • Changes the grant approval form action to be relative (action="approve")
  • Changes the redirect from the approval flow back to the authorize endpoint to be relative (Location: ../authorize)
  • Adds validation to RequestHeaderIdentityProvider loginURL to catch two scenarios that would prevent relative redirects from working (trailing / and the proxy path not ending in /authorize)

Tasks:

  • Test:
    • Firefox
    • IE 11
    • IE 11 Intranet mode
    • Safari
    • Chrome
    • iOS
  • Update unit/integration tests
  • Update documentation - Update authentication proxy requirements openshift-docs#4079
    • the auth proxy endpoint that proxies to /oauth/authorize must also proxy subpaths (notably /oauth/authorize/approve)
    • the auth proxy endpoint that proxies to /oauth/authorize must end with .../authorize (with no trailing slash)

@liggitt liggitt changed the title Redirect to relative subpath for approval, relative parent path on success WIP - redirect to relative subpath for approval, relative parent path on success Mar 29, 2017
reqURL := &(*req.URL)
reqURL.Host = ""
reqURL.Scheme = ""
reqURL.Path = path.Join("..", lastSegment)
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

Copy link
Contributor Author

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/

Copy link
Contributor Author

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, "/") {
Copy link
Contributor

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?

Copy link
Contributor Author

@liggitt liggitt Mar 29, 2017

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

@liggitt
Copy link
Contributor Author

liggitt commented Apr 3, 2017

[test]

@liggitt liggitt changed the title WIP - redirect to relative subpath for approval, relative parent path on success Redirect to relative subpath for approval, relative parent path on success Apr 3, 2017
@enj
Copy link
Contributor

enj commented Apr 4, 2017

LGTM 👍 :shipit:

@liggitt
Copy link
Contributor Author

liggitt commented Apr 4, 2017

[merge]

@openshift-bot
Copy link
Contributor

openshift-bot commented Apr 4, 2017

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)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to f42b363

@liggitt
Copy link
Contributor Author

liggitt commented Apr 4, 2017

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to f42b363

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/556/) (Base Commit: f0670df)

@openshift-bot openshift-bot merged commit 6a175fa into openshift:master Apr 4, 2017
@liggitt liggitt deleted the relative-approval-redirect branch April 7, 2017 14:55
enj added a commit to enj/openshift-docs that referenced this pull request May 3, 2018
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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request May 11, 2018
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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
kalexand-rh pushed a commit to kalexand-rh/openshift-docs that referenced this pull request Jun 11, 2018
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants