openshift / console

OpenShift Cluster Console UI
https://www.openshift.org
Apache License 2.0
401 stars 613 forks source link

OCPBUGS-43516: Added token to proxy header #14411

Closed Lucifergene closed 1 month ago

Lucifergene commented 1 month ago

Jira Link: https://issues.redhat.com/browse/OCPBUGS-43516

This pull request introduces several changes to the proxy handling mechanism in the devconsole package, focusing on adding user authentication and enhancing the proxy request structure.

Enhancements to Proxy Request Structure:

User Authentication Integration:

Test Updates for Authentication:

vikram-raj commented 1 month ago

/retitle OCPBUGS-43516 Added token to proxy header

openshift-ci-robot commented 1 month ago

@Lucifergene: This pull request references Jira Issue OCPBUGS-43516, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug * bug is open, matching expected state (open) * bug target version (4.18.0) matches configured target version for branch (4.18.0) * bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact: /cc @sanketpathak

The bug has been updated to refer to the pull request using the external bug tracker.

In response to [this](https://github.com/openshift/console/pull/14411): > Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=openshift%2Fconsole). If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
openshift-ci-robot commented 1 month ago

@Lucifergene: This pull request references Jira Issue OCPBUGS-43516, which is valid.

3 validation(s) were run on this bug * bug is open, matching expected state (open) * bug target version (4.18.0) matches configured target version for branch (4.18.0) * bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact: /cc @sanketpathak

In response to [this](https://github.com/openshift/console/pull/14411): >Jira Link: https://issues.redhat.com/browse/OCPBUGS-43516 > > > > Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=openshift%2Fconsole). If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
Lucifergene commented 1 month ago

/label tide/merge-method-squash

lokanandaprabhu commented 1 month ago

/lgtm

openshift-ci[bot] commented 1 month ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jhadvig, lokanandaprabhu, Lucifergene

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[frontend/OWNERS](https://github.com/openshift/console/blob/master/frontend/OWNERS)~~ [jhadvig] - ~~[pkg/OWNERS](https://github.com/openshift/console/blob/master/pkg/OWNERS)~~ [jhadvig] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
openshift-ci[bot] commented 1 month ago

@Lucifergene: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
openshift-ci-robot commented 1 month ago

@Lucifergene: Jira Issue OCPBUGS-43516: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-43516 has been moved to the MODIFIED state.

In response to [this](https://github.com/openshift/console/pull/14411): >Jira Link: https://issues.redhat.com/browse/OCPBUGS-43516 > >This pull request introduces several changes to the proxy handling mechanism in the `devconsole` package, focusing on adding user authentication and enhancing the proxy request structure. > >### Enhancements to Proxy Request Structure: > >* [`frontend/packages/console-shared/src/utils/proxy.ts`](diffhunk://#diff-ba8011c27d95ec1f52aa24715df6dff6c828a075b260c0662649a0791e01b90cR9): Added `allowAuthHeader` property to `ProxyRequest` type. >* [`pkg/devconsole/proxy/types.go`](diffhunk://#diff-1dde1ac1e35f65a2925df3e67317029db43db6bc5f9562e78878da2bdefee33aR10): Added `AllowAuthHeader` field to `ProxyRequest` struct. > >### User Authentication Integration: > >* [`pkg/devconsole/proxy/proxy.go`](diffhunk://#diff-e6afaef81a1d41c4545ced85d8389ed750ead55051b4f1ea6639f384b11cb106R11-R21): Modified `Handler` and `serve` functions to accept a `user` parameter of type `*auth.User`. Added logic to include `Authorization` header in the service request if `AllowAuthHeader` is true. [[1]](diffhunk://#diff-e6afaef81a1d41c4545ced85d8389ed750ead55051b4f1ea6639f384b11cb106R11-R21) [[2]](diffhunk://#diff-e6afaef81a1d41c4545ced85d8389ed750ead55051b4f1ea6639f384b11cb106L37-R42) [[3]](diffhunk://#diff-e6afaef81a1d41c4545ced85d8389ed750ead55051b4f1ea6639f384b11cb106R66-R69) >* [`pkg/server/server.go`](diffhunk://#diff-104a11712684e520f0affa95e6a053faeb713306a10f69ee99b9729cc9dd1996L481-R481): Updated `HTTPHandler` method to pass the `user` parameter to `devconsoleProxy.Handler`. > >### Test Updates for Authentication: > >* [`pkg/devconsole/proxy/proxy_test.go`](diffhunk://#diff-78dc92931f07d7790c90f334c28de34f08153c49800e42723caf5e2ca1c53765R10-R19): Added `user` variable and updated tests to include `Authorization` header in requests and responses. [[1]](diffhunk://#diff-78dc92931f07d7790c90f334c28de34f08153c49800e42723caf5e2ca1c53765R10-R19) [[2]](diffhunk://#diff-78dc92931f07d7790c90f334c28de34f08153c49800e42723caf5e2ca1c53765R37) [[3]](diffhunk://#diff-78dc92931f07d7790c90f334c28de34f08153c49800e42723caf5e2ca1c53765R52) [[4]](diffhunk://#diff-78dc92931f07d7790c90f334c28de34f08153c49800e42723caf5e2ca1c53765R64) [[5]](diffhunk://#diff-78dc92931f07d7790c90f334c28de34f08153c49800e42723caf5e2ca1c53765L70-R81) > > > > Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=openshift%2Fconsole). If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
Lucifergene commented 1 month ago

/cherry-pick release-4.17

openshift-cherrypick-robot commented 1 month ago

@Lucifergene: new pull request created: #14430

In response to [this](https://github.com/openshift/console/pull/14411#issuecomment-2432468327): >/cherry-pick release-4.17 Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
openshift-bot commented 1 month ago

[ART PR BUILD NOTIFIER]

Distgit: openshift-enterprise-console This PR has been included in build openshift-enterprise-console-container-v4.18.0-202410231641.p0.g6577e73.assembly.stream.el9. All builds following this will include this PR.