Skip to content

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

Merged
openshift-bot merged 2 commits into
openshift:masterfrom
liggitt:relative-approval-redirect
Apr 4, 2017
Merged

openshift-bot merged 2 commits into
openshift:masterfrom
liggitt:relative-approval-redirect

Conversation

@liggitt

@liggitt liggitt commented Mar 29, 2017 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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?

@liggitt liggitt Mar 29, 2017 •

Copy link
Copy Markdown
Contributor Author

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

liggitt commented Apr 3, 2017

Copy link
Copy Markdown
Contributor Author

[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

enj commented Apr 4, 2017

Copy link
Copy Markdown
Contributor

LGTM 👍 :shipit:

@liggitt

liggitt commented Apr 4, 2017

Copy link
Copy Markdown
Contributor Author

[merge]

@openshift-bot

openshift-bot commented Apr 4, 2017 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

Evaluated for origin merge up to f42b363

@liggitt

liggitt commented Apr 4, 2017

Copy link
Copy Markdown
Contributor Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to f42b363

@openshift-bot

Copy link
Copy Markdown
Contributor

@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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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.

4 participants