An http proxy that uses the DiscourseConnect protocol to authenticate users
Go to file
Saj Goonatilleke 6370ef8f24 docker: build with explicit go version
It is occasionally useful to assert that our output was built with >=x
version of the Go compiler or linked against >=x version of the Go
standard library.  While it is possible to make this assertion after the
fact -- say, by dumping the value of runtime.buildVersion with a
debugger -- it's usually much easier to inspect this file.
2020-11-19 05:10:43 +11:00
internal/httpproxy Optionally use DNS SRV records for origin discovery 2019-05-07 04:48:50 +10:00
.gitignore Initial commit 2015-04-15 13:18:18 +10:00
Dockerfile docker: build with explicit go version 2020-11-19 05:10:43 +11:00
Makefile make: build against latest mutable alpine tag 2020-11-19 05:06:42 +11:00
README.md FIX: we moved the image 2019-07-03 12:49:57 -04:00
config.go deref pointers 2020-11-06 09:25:38 +11:00
docker-entrypoint switch to go modules 2020-11-06 08:50:35 +11:00
go.mod switch to go modules 2020-11-06 08:50:35 +11:00
go.sum switch to go modules 2020-11-06 08:50:35 +11:00
logging.go Add error logging to aid in SSO debugging 2019-07-24 00:25:54 +10:00
main.go encode /sso_provider query parameters 2020-11-06 09:37:40 +11:00
main_test.go Fix tests 2019-05-15 17:44:44 +10:00

README.md

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.forum.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