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

Return the auth challenge in the WWW-Authenticate when auth fails #1387

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

KeesV
Copy link

@KeesV KeesV commented Dec 7, 2020

Fixes / New Feature

Perform Challenge on failed authentication, and return the generated WWW-Authenticate header in the upstream response.

Proposed Changes

  • In AuthenticationMiddleware.cs: perform a challenge whenever authentication fails. This generates a WWW-Authenticate header on the response.
  • It seems that the httpContext.Response that is available in AuthenticationMiddleware.cs is recreated/overwritten further down the pipeline, so we need to preserve the generated WWW-Authenticate header somewhere. For now, I've put it in the httpContext.Items (suggestions on how to do this in a better way are highly appreciated).
  • Re-apply the WWW-Authenticate header on the response in ResponderMiddleware.cs.

@arnaulddumez
Copy link

Same problem for Access-Control-Allow-Origin ??

@raman-m
Copy link
Member

raman-m commented Jul 15, 2023

Hi Kees!
Thanks for your interest in Ocelot!

Could you Sync fork please? So, your develop branch is outdated!

@raman-m raman-m self-requested a review July 15, 2023 13:36
@raman-m raman-m force-pushed the dev-return-auth-challenge-on-401 branch from 40f5d8e to 0e5ab4e Compare August 21, 2023 16:05
@raman-m
Copy link
Member

raman-m commented Aug 21, 2023

The feature branch has been rebased onto ThreeMammals:develop!

@KeesV
Your develop branch in your fork is too old!
It seems building pipeline cannot start because your fork repo is old.

Could you Sync fork please? The develop branch will be updated by top commits!
Could you add me as collaborator to your forked repo please?

@raman-m
Copy link
Member

raman-m commented Aug 21, 2023

@KeesV
Thanks for the great PR!
Is the PR related to some issue in backlog?

@raman-m raman-m added feature A new feature question Initially seen a question could become a new feature or bug or closed ;) needs feedback Issue is waiting on feedback before acceptance waiting Waiting for answer to question or feedback from issue raiser labels Aug 21, 2023
@KeesV
Copy link
Author

KeesV commented Aug 21, 2023

hey @raman-m! Thanks for revitalizing this PR. It's great to see some activity here.
I've synced my fork and added you as a contributor there, should you want to make any changes.
I don't think there's any issue in the backlog for this PR as of now.

@raman-m raman-m force-pushed the dev-return-auth-challenge-on-401 branch from a5b94fd to 9564e2c Compare August 22, 2023 09:39
@raman-m
Copy link
Member

raman-m commented Aug 22, 2023

CircleCI status: pull/1387
I don't see any jobs/pipelines for your feature branch.
So, building of feature branch cannot start for a some reason. It is strange!
It seems you need to re-fork the repo because of some old repo state... I believe, re-forking should help to recover the building pipeline.
But before doing that, make a file backup, or it is better just to make git diff patch please:

git diff commit1..commit2 > ../pull-1387.patch

After that for new fork, and new feature branch (base is develop) you need just to apply the patch:

git apply ../pull-1387.patch

Git recipe was taken from here: Stack Overflow | Create patch or diff file from git repository and apply it to another different git repository

@raman-m
Copy link
Member

raman-m commented Jun 11, 2024

Hello @KeesV !
Are you still with Ocelot?

@raman-m raman-m force-pushed the dev-return-auth-challenge-on-401 branch from e99b633 to 34eb955 Compare November 7, 2024 09:37
@raman-m raman-m added proposal Proposal for a new functionality in Ocelot Authentication Ocelot feature: Authentication and removed feature A new feature question Initially seen a question could become a new feature or bug or closed ;) needs feedback Issue is waiting on feedback before acceptance waiting Waiting for answer to question or feedback from issue raiser labels Nov 7, 2024
@raman-m
Copy link
Member

raman-m commented Nov 7, 2024

@KeesV commented on Aug 21, 2023

Could you sync fork once again please?
The CI build can't start because of outdated develop. Or add me as collaborator to your forked repo plz!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Authentication Ocelot feature: Authentication proposal Proposal for a new functionality in Ocelot
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants