Skip to content

Commit c8235e1

Browse files
authored
feat: pocket id guide (#13)
1 parent 33e9017 commit c8235e1

10 files changed

Lines changed: 110 additions & 8 deletions

.vitepress/config.mts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,27 @@ export default withMermaid(
3434
{
3535
text: "Guides",
3636
items: [
37-
{ text: "Github OAuth", link: "/docs/guides/github-oauth" },
38-
{ text: "Google OAuth", link: "/docs/guides/google-oauth" },
39-
{ text: "Github App OAuth", link: "/docs/guides/github-app-oauth" },
4037
{
4138
text: "Using the binary",
4239
link: "/docs/guides/using-the-binary",
4340
},
44-
{ text: "Access controls", link: "/docs/guides/access-controls" },
4541
{
4642
text: "Two factor authentication",
4743
link: "/docs/guides/totp",
4844
},
45+
{ text: "Access controls", link: "/docs/guides/access-controls" },
46+
{ text: "Google OAuth", link: "/docs/guides/google-oauth" },
47+
{ text: "Github OAuth", link: "/docs/guides/github-oauth" },
48+
{ text: "Github App OAuth", link: "/docs/guides/github-app-oauth" },
4949
{ text: "Tinyauth with Runtipi", link: "/docs/guides/runtipi" },
50+
{
51+
text: "Tinyauth with Pocket ID",
52+
link: "/docs/guides/pocket-id",
53+
},
5054
{
5155
text: "Tinyauth with Nginx Proxy Manager",
5256
link: "/docs/guides/nginx-proxy-manager",
53-
},
57+
}
5458
],
5559
},
5660
{

docs/guides/github-app-oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ tinyauth:
6161
```
6262
6363
::: warning
64-
OAuth doesn't mean security, with the current setup everybody with a Github account can login to Tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
64+
OAuth doesn't mean security, with the current setup everybody with a Github account can login to tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
6565
:::
6666

6767
::: tip

docs/guides/github-oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ tinyauth:
5757
```
5858
5959
::: warning
60-
OAuth doesn't mean security, with the current setup everybody with a Github account can login to Tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
60+
OAuth doesn't mean security, with the current setup everybody with a Github account can login to tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
6161
:::
6262

6363
::: tip

docs/guides/google-oauth.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ tinyauth:
7777
```
7878
7979
::: warning
80-
OAuth doesn't mean security, with the current setup everybody with a Github account can login to Tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
80+
OAuth doesn't mean security, with the current setup everybody with a Github account can login to tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
8181
:::
8282

8383
::: tip

docs/guides/pocket-id.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Tinyauth with Pocket ID
2+
3+
[Pocket ID](https://pocket-id.org) is a really popular OIDC server that allows you to login to your apps with passkeys. Most proxies do not support OIDC/OAuth servers for authentication meaning that Pocket ID cannot be connected with them. With tinyauth you can connect Pocket ID to your favorite proxy and use it to secure your apps.
4+
5+
## Requirements
6+
7+
This guide assumes you have a working Pocket ID installation. If you don't already have one you can checkout [Pocket ID's documentation](https://pocket-id.org/docs/setup/installation) on how to install it.
8+
9+
## Configuring Pocket ID
10+
11+
To begin with you should visit Pocket ID's admin dashboard which should look like this:
12+
13+
![Pocket ID Admin Page](/screenshots/pocket-id-home.png)
14+
15+
There you should go to the _OIDC Clients_ tab and click _Add OIDC Client_. A new menu will appear prompting you to provide some information. We only need to set two of these fields.
16+
17+
**Name** -> Give your client a name. You can use `Tinyauth`
18+
19+
**Callback URLs** -> Here, you will need to fill in your tinyauth app URL followed by `/api/oauth/callback/generic`. For example `https://tinyauth.example.com/api/oauth/callback/generic`.
20+
21+
![Pocket ID Create Client](/screenshots/pocket-id-new-client.png)
22+
23+
You can also upload a logo for your OIDC client. You can download the tinyauth logo from [Github](https://github.com/steveiliop56/tinyauth/blob/main/frontend/public/logo.png).
24+
25+
Finally click _Save_. A new page should be appear containing your OIDC credentials:
26+
27+
![Pocket ID Client Page](/screenshots/pocket-id-client-page.png)
28+
29+
Make sure to note down your client ID and secret as we will need them later.
30+
31+
## Configuring Tinyauth
32+
33+
In order for Pocket ID to work with tinyauth we will need to use the generic provider. An example configuration will look like:
34+
35+
```yaml
36+
tinyauth:
37+
image: ghcr.io/steveiliop56/tinyauth:v3
38+
container_name: tinyauth
39+
restart: unless-stopped
40+
environment:
41+
- SECRET=some-random-32-chars-string
42+
- APP_URL=https://tinyauth.example.com
43+
- GENERIC_CLIENT_ID=your-pocket-id-client-id
44+
- GENERIC_CLIENT_SECRET=your-pocket-id-client-secret
45+
- GENERIC_AUTH_URL=https://pocket-id.example.com/authorize
46+
- GENERIC_TOKEN_URL=https://pocket-id.example.com/api/oidc/token
47+
- GENERIC_USER_URL=https://pocket-id.example.com/api/oidc/userinfo
48+
- GENERIC_SCOPES=openid email profile groups
49+
- GENERIC_NAME=Pocket ID
50+
labels:
51+
traefik.enable: true
52+
traefik.http.routers.tinyauth.rule: Host(`tinyauth.example.com`)
53+
traefik.http.middlewares.tinyauth.forwardauth.address: http://tinyauth:3000/api/auth/traefik
54+
```
55+
56+
::: tip
57+
You can set the `OAUTH_AUTO_REDIRECT` environment variable to `generic` so every time you try to access a tinyauth app you will be automatically redirected to Pocket ID.
58+
:::
59+
60+
::: warning
61+
OAuth doesn't mean security, with the current setup everybody with a Pocket ID account can login to tinyauth as a normal user. If you would like to limit which users can login with OAuth, you can add the `OAUTH_WHITELIST` environment variable and only allow your email address to login. For more information check the [configuration](/docs/reference/configuration.md) page.
62+
:::
63+
64+
And you are done! After you restart tinyauth and try to login to an app, you should have an additional option to login with Pocket ID.
65+
66+
## Access controls with Pocket ID groups
67+
68+
Pocket ID has support for user groups, this can be useful for managing your access controls entirely through Pocket ID and not through whitelists on tinyauth. To use groups you will firstly need to create one. To do so firstly go to the _User Groups_ tab and click _Add Group_. There you should give it a name and click _Save_.
69+
70+
![Pocket ID New Group](/screenshots/pocket-id-new-group.png)
71+
72+
After you create your group, you will be prompted to select the users included in it. You can select as many users as you like.
73+
74+
![Pocket ID Group Home](/screenshots/pocket-id-group-home.png)
75+
76+
Finally you will need to configure the tinyauth protected apps to require OAuth groups. This can be configured with a simple label:
77+
78+
```yaml
79+
whoami:
80+
container_name: whoami
81+
image: traefik/whoami:latest
82+
restart: unless-stopped
83+
labels:
84+
traefik.enable: true
85+
traefik.http.routers.nginx.rule: Host(`whoami.example.com`)
86+
traefik.http.routers.nginx.middlewares: tinyauth
87+
tinyauth.oauth.groups: admins # <-- Added line
88+
```
89+
90+
In this example, only the Pocket ID users within the `admins` group will be able to access the app. Users not included in the group will be redirected to an unauthorized page.
91+
92+
::: warning
93+
In order for the access controls to work the app must have the same container name as the subdomain it is exposed at, e.g. container name should be `hello` and the app should be exposed at `hello.example.com`. Using a different subdomain will **_not_** work.
94+
:::
95+
96+
::: info
97+
The OAuth and user whitelist can be a regular regex expression if it has the slash (`/`) prefix and suffix.
98+
:::
168 KB
Loading
130 KB
Loading
178 KB
Loading
172 KB
Loading
134 KB
Loading

0 commit comments

Comments
 (0)