Skip to content

auth: auth-proxy-http-header command for testing multiple users

Warren Gifford requested to merge k/20220721-auth-proxy into main

Created by: keegancsmith

For permission testing I wrote this command to very conveniently switch between users. This is kind of like the already existing testproxy, except much more convenient to use as well as being targetted for auth testing rather than http-header testing.

I'm unsure of how to document this further so people are aware of it. Alternatively I think it is also useful to maybe spin up by default in our enterprise env. I'll leave both of those for future PRs. For now I will advertise in #dev-chat and #dev-experience.

Here is the example output to give you a feel for what it does:

$ go run ./internal/cmd/auth-proxy-http-header
https://docs.sourcegraph.com/admin/auth#http-authentication-proxies

  "auth.providers": [
    {
      "type": "http-header",
      "usernameHeader": "X-Forwarded-User",
      "emailHeader": "X-Forwarded-Email"
    }
  ]

Visit http://127.0.0.1:10810 for keegan [email protected]
Visit http://127.0.0.1:10811 for user1 [email protected]
Visit http://127.0.0.1:10812 for user2 [email protected]
Visit http://127.0.0.1:10813 for user3 [email protected]
Visit http://127.0.0.1:10814 for user4 [email protected]
Visit http://127.0.0.1:10815 for user5 [email protected]

Test Plan: Ran locally

Merge request reports

Loading