Skip to content

Commit 5c3079a

Browse files
weltekialexellis
authored andcommitted
Update http authentication instructions for Google
Update the http OAuth authentication instructions. - Add a section to show how to use Google as an OAuth provider - Update the GitHub OAuth section for the new org acl. Signed-off-by: Han Verstraete (OpenFaaS Ltd) <[email protected]>
1 parent 58f5f78 commit 5c3079a

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

docs/images/google-oauth-client.png

26.9 KB
Loading

docs/tutorial/http-authentication.md

+47-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ With OAuth:
7676

7777
The OAuth 2.0 flow requires a web-browser, so if you anticipate mixed use, then you can combine it with Bearer Token Authentication, for headless clients.
7878

79+
The tunnel client currently has three reserved paths for OAuth:
80+
- `/_/oauth/login` hosts the login page.
81+
- `/_/oauth/logout` can be used to log out.
82+
- `/_/oauth/callback` is used for the OAuth 2.0 callbacks.
83+
84+
Paths prefixed with `/_/oauth` can not be used by the tunneled service.
85+
7986
### Example with GitHub.com
8087

8188
The example below will expose: `http://127.0.0.1:3000` using the domain name `tunnel.example.com`.
@@ -103,6 +110,10 @@ inlets-pro http client \
103110
--oauth-acl [email protected]
104111
```
105112

113+
Access to the tunnel can be controlled using the `--oauth-acl` flag. Users can be filtered by username and email.
114+
115+
Tunnels using a commercial inlets license can also control access based on organisation membership. Providing the flag `--oauth-acl=org:inlets` would allow all users that are a member of the inlets GitHub organisation to access the tunnel.
116+
106117
Once authenticated, a cookie will be set on the domain i.e. `tunnel.example.com` and the user will be redirected back to the root URL of the service `/`.
107118

108119
The duration of the cookie defaults to 1 hour, but can be extended through the `--oauth-cookie-ttl` flag i.e.
@@ -112,6 +123,41 @@ inlets-pro http client \
112123
+ --oauth-cookie-ttl 24h \
113124
```
114125

115-
For the first version, GitHub is the only option available for the `--oauth-provider`. More options will be added over time, based upon requests from users, so if you want to use Google, Facebook, GitLab, etc, send us an email to help with prioritisation.
126+
### Example with Google
127+
128+
> To use the Google provider you need a commercial Inlets license.
129+
130+
1. Setup a new project in the [Google API console](https://console.developers.google.com/)
131+
2. Configure the project OAuth consent screen.
132+
133+
Follow the steps to configure the [OAuth consent screen](https://console.developers.google.com/apis/credentials/consent).
134+
135+
If you are a Google Workspace user you can make your app available to any user within your organization by registering it as an internal app.
136+
137+
3. Create a new OAuth client
138+
139+
[Create a new OAuth client](https://console.cloud.google.com/auth/clients/create) with the application type `Web Application`.
140+
Fill out the name and add the callback URL for your tunnel to the list of valid redirect URIs.
141+
142+
Example of a redirect uri: `http://tunnel.example.com/_/oauth/callback`. The callback for a tunnel is always available at `/_/oauth/callback`.
143+
144+
![Example of a Google OAuth client configuration](/images/google-oauth-client.png)
145+
146+
4. Save the Client ID and Client secret in a convenient place so they can be used when connecting the tunnel.
147+
148+
Connect the client:
149+
150+
```sh
151+
inlets-pro http client \
152+
--upstream tunnel.example.com=http://127.0.0.1:3000 \
153+
--oauth-client-id $(cat ~/.inlets/oauth-client-id) \
154+
--oauth-client-secret $(cat ~/.inlets/oauth-client-secret) \
155+
--oauth-provider google \
156+
--oauth-acl [email protected]
157+
```
158+
159+
You can control which users are allowed to access the tunnel by providing an email address using the `--oauth-acl` flag.
160+
161+
More providers will be added over time, based upon requests from users, so if you want to use Facebook, GitLab, etc, send us an email to help with prioritisation.
116162

117163

0 commit comments

Comments
 (0)