You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A minimal forward authentication service that provides Google oauth based login and authentication for the [traefik](https://github.com/containous/traefik) reverse proxy/load balancer.
5
+
A minimal forward authentication service that provides OAuth/SSO login and authentication for the [traefik](https://github.com/containous/traefik) reverse proxy/load balancer.
6
6
7
7
## Why?
8
8
9
9
- Seamlessly overlays any http service with a single endpoint (see: `url-path` in [Configuration](#configuration))
10
+
- Supports multiple providers including Google and OpenID Connect (supported by Azure, Github, Salesforce etc.)
10
11
- Supports multiple domains/subdomains by dynamically generating redirect_uri's
11
12
- Allows authentication to be selectively applied/bypassed based on request parameters (see `rules` in [Configuration](#configuration)))
12
13
- Supports use of centralised authentication host/redirect_uri (see `auth-host` in [Configuration](#configuration)))
@@ -19,7 +20,7 @@ A minimal forward authentication service that provides Google oauth based login
19
20
-[Usage](#usage)
20
21
-[Simple](#simple)
21
22
-[Advanced](#advanced)
22
-
-[OAuth Configuration](#oauth-configuration)
23
+
-[Provider Setup](#provider-setup)
23
24
-[Configuration](#configuration)
24
25
-[Overview](#overview)
25
26
-[Option Details](#option-details)
@@ -46,7 +47,7 @@ v2 was released in June 2019, whilst this is fully backwards compatible, a numbe
46
47
47
48
#### Simple:
48
49
49
-
See below for instructions on how to setup your [OAuth Configuration](#oauth-configuration).
50
+
See below for instructions on how to setup your [Provider Setup](#provider-setup).
- INSECURE_COOKIE=true # Example assumes no https, do not use in production
72
73
@@ -98,14 +99,24 @@ Please see the examples directory for a more complete [docker-compose.yml](https
98
99
99
100
Also in the examples directory is [docker-compose-auth-host.yml](https://github.com/thomseddon/traefik-forward-auth/blob/master/examples/docker-compose-auth-host.yml) which shows how to configure a central auth host, along with some other options.
100
101
101
-
#### OAuth Configuration
102
+
#### Provider Setup
103
+
104
+
##### Google
102
105
103
106
Head to https://console.developers.google.com and make sure you've switched to the correct email account.
104
107
105
108
Create a new project then search for and select "Credentials" in the search bar. Fill out the "OAuth Consent Screen" tab.
106
109
107
110
Click "Create Credentials" > "OAuth client ID". Select "Web Application", fill in the name of your app, skip "Authorized JavaScript origins" and fill "Authorized redirect URIs" with all the domains you will allow authentication from, appended with the `url-path` (e.g. https://app.test.com/_oauth)
108
111
112
+
You must set the `providers.google.client-id` and `providers.google.client-secret` config options.
113
+
114
+
##### OpenID Connect
115
+
116
+
Any provider that supports OpenID Connect 1.0 can be configured via the OIDC config options below.
117
+
118
+
You must set the `providers.oidc.issuer-url`, `providers.oidc.client-id` and `providers.oidc.client-secret` config options.
119
+
109
120
## Configuration
110
121
111
122
### Overview
@@ -126,18 +137,24 @@ Application Options:
126
137
--cookie-name= Cookie Name (default: _forward_auth) [$COOKIE_NAME]
127
138
--csrf-cookie-name= CSRF Cookie Name (default: _forward_auth_csrf) [$CSRF_COOKIE_NAME]
@@ -210,6 +227,12 @@ All options can be supplied in any of the following ways, in the following prece
210
227
211
228
Default: `auth` (i.e. all requests require authentication)
212
229
230
+
-`default-provider`
231
+
232
+
Set the default provider to use for authentication, this can be overridden within [rules](#rules). Valid options are currently `google` or `oidc`.
233
+
234
+
Default: `google`
235
+
213
236
-`domain`
214
237
215
238
When set, only users matching a given domain will be permitted to access.
@@ -253,6 +276,9 @@ All options can be supplied in any of the following ways, in the following prece
253
276
-`action` - same usage as [`default-action`](#default-action), supported values:
254
277
- `auth` (default)
255
278
- `allow`
279
+
-`provider` - same usage as [`default-provider`](#default-provider), supported values:
280
+
-`google`
281
+
-`oidc`
256
282
-`rule` - a rule to match a request, this uses traefik's v2 rule parser for which you can find the documentation here: https://docs.traefik.io/v2.0/routing/routers/#rule, supported values are summarised here:
257
283
-``Headers(`key`, `value`)``
258
284
-``HeadersRegexp(`key`, `regexp`)``
@@ -265,14 +291,19 @@ All options can be supplied in any of the following ways, in the following prece
265
291
266
292
For example:
267
293
```
294
+
# Allow requests that being with `/api/public` and contain the `Content-Type` header with a value of `application/json`
# Allow requests that have the exact path `/public`
271
299
rule.two.action = allow
272
300
rule.two.rule = Path(`/public`)
273
-
```
274
301
275
-
In the above example, the first rule would allow requests that begin with `/api/public` and contain the `Content-Type` header with a value of `application/json`. It would also allow requests that had the exact path `/public`.
302
+
# Use OpenID Connect provider (must be configured) for requests that begin with `/github`
0 commit comments