MCPcopy Index your code
hub / github.com/discourse/discourse-auth-proxy

github.com/discourse/discourse-auth-proxy @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
68 symbols 186 edges 6 files 10 documented · 15%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Discourse Auth Proxy

This package allows you to use Discourse as an SSO endpoint for an arbitrary site.

Discourse SSO is invoked prior to serving the proxied site. This allows you to reuse Discourse Auth in a site that ships with no auth.

Usage:

Usage of ./discourse-auth-proxy:
  -listen-url="": uri to listen on eg: localhost:2001. leave blank to set equal to proxy-url
  -origin-url="": origin to proxy eg: http://localhost:2002
  -proxy-url="": outer url of this host eg: http://secrets.example.com
  -sso-secret="": SSO secret for origin
  -sso-url="": SSO endpoint eg: http://discourse.example.com
  -allow-all: don't restrict access to "admin" users on the SSO endpoint
  -timeout="10": Read/Write timeout
+--------+    proxy-url   +---------+    listen-url    +----------------------+
|  User  |  ============> |  Nginx  |  ==============> | discourse-auth-proxy |
+--------+                +---------+                  +----------------------+
    |                                                             |
    | sso-url                                          origin-url |
    |                                                             |
    v                                                             v
+-----------+                                          +----------------------+
| Discourse |                                          | Protected web server |
+-----------+                                          +----------------------+

Environment variables may be used as a substitute for command-line flags, e.g.:

ORIGIN_URL='http://somesite.com' \
PROXY_URL='http://listen.com' \
SSO_SECRET='somesecret' \
SSO_URL='http://somediscourse.com' \
./discourse-auth-proxy

-origin-url may specify a name equipped with RFC 2782 DNS SRV records, such as http://_foo._tcp.example.com. If SRV records are found in the DNS, each request is proxied to a host and port taken from these records.

Docker Image

You may run using docker using

docker run discourse/auth-proxy

Running will display configuration instructions

A new OCI image is automatically published to Docker Hub upon every push to branch main on GitHub. The release procedure is documented in t/120578 for the benefit of CDCK staff.

Extension points exported contracts — how you extend this code

SSOOverrideFunc (FuncType)
(no doc)
main_test.go
ConfigOverrideFunc (FuncType)
(no doc)
main_test.go

Core symbols most depended-on inside this repo

NewStringSet
called by 7
string_set.go
computeHMAC
called by 5
main.go
allowedByWhiteList
called by 4
main.go
signCookie
called by 4
main.go
parseCookie
called by 4
main.go
Printf
called by 3
logging.go
authProxyHandler
called by 2
main.go
addNonce
called by 2
main.go

Shape

Function 43
Method 14
Struct 6
FuncType 3
TypeAlias 2

Languages

Go100%

Modules by API surface

main_test.go20 symbols
internal/httpproxy/backend.go18 symbols
main.go12 symbols
logging.go9 symbols
config.go5 symbols
string_set.go4 symbols

For agents

$ claude mcp add discourse-auth-proxy \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact