feat: implement unauthorized passthrough of requests#260
feat: implement unauthorized passthrough of requests#260bastianjoel wants to merge 1 commit intosevensolutions:mainfrom
Conversation
cfae9b8 to
0d0f567
Compare
|
Hi @bastianjoel, I have a few questions about this or things I want to mention:
What do you think about adding an option which controls "when" headers are sent. SendHeaders: "OnAuthorized" (default)
SendHeaders: "Always"But: While writing my reply and thinking about this whole thing I'am questioning: Do you really want "unauthorized passthrough" in terms of forwarding every request upstream, even if the user not authorized? And if yes, could you please give me a use-case for that? |
|
Thanks for taking a look!
I agree that the naming might not be ideal. We have some services in our stack that do not require a user to be authenticated. In that case we want those to pass the
I am aware of this. The problem is that routes listed for that option do not receive information about the currently authenticated user.
The reason why I implemented it via a "global" setting is because we only need this on a per service level. This is also suggested in the issue:
However I see that it might make more sense to couple this to the
We might do not want that but instead just for unauthenticated. This is more for error handling as we need one of our services to be always reachable even if something weird happens. In that case no Our use case will be https://github.com/OpenSlides/openslides-autoupdate-service for that. We have a single route there where a user can request data. This data is then restricted by the service itself which can also handle "anonymous" users and provide only public information to those. |
|
Thank you for the explanations @bastianjoel. A) Always sending requests to the upstream, no matter if they're authenticated or not. For this scenario we could add another value to the sequenceDiagram
alt Unauthorized Request with Unauthorized Behavior=Challenge
Client->>traefik: Request
traefik->>Client: Redirect to IDP
end
alt Unauthorized Request with Unauthorized Behavior=Unauthorized
Client->>traefik: Request
traefik->>Client: Unauthorized (401)
end
alt Unauthorized Request with Unauthorized Behavior=Forward
Client->>traefik: Request
traefik->>Upstream: Forward Request
Upstream->>traefik: Response
traefik->>Client: Response
end
B) Sending headers with unauthenticated requests (on public routes or forwarded ones). Eg.: Headers:
- Name: "Authorization"
Value: "{{`Bearer {{ .accessToken }}`}}"
IncludeWhen: "Authorized" or "Always"What do you think? |
|
That would still fit our use case and I like the semantics much better than from my initial proposal. I am planning to add those changes next week. |
resolves #232