|
| 1 | +# OAuth2 Bridge |
| 2 | + |
| 3 | +A small UI that allows to proxy oAuth2 providers that does not allow wildcard redirect uris. |
| 4 | +This is especially a problem when dealing with review environments or multi tenant environments based on subdomains. |
| 5 | + |
| 6 | +## Usage |
| 7 | + |
| 8 | +Use it via the docker image `ghcr.io/geprog/oauth2-bridge` with the following environment variables |
| 9 | + |
| 10 | +- `NUXT_AUTH_NAME` - the session cookie name. Defaults to `oauth2-bridge-session` |
| 11 | +- `NUXT_AUTH_PASSWORD` - the master password for the admin console. Should be a random 64 characters long key. |
| 12 | + |
| 13 | +The docker container exposes the entre app under port `3000`. |
| 14 | + |
| 15 | +To persist data you should mount a volume `/app/data`. |
| 16 | + |
| 17 | +### Managing proxies |
| 18 | + |
| 19 | +In the UI you can configure different proxies. |
| 20 | +Per proxy you need to set |
| 21 | +- a `name` (must be unique) |
| 22 | +- an authorization URI e.g. `https://login.microsoftonline.com/${TENANT_ID}/oauth2/v2.0/authorize` (with your specific tenant id of course) |
| 23 | +- a token URI e.g. `https://login.microsoftonline.com/${TENANT_ID}/oauth2/v2.0/token` (with your specific tenant id of course) |
| 24 | + |
| 25 | +You can also add and remove redirect URIs per proxy. |
| 26 | + |
| 27 | +To use your proxy you need to configure your app to use the following paths of the hosted oauth2-bridge |
| 28 | +- Authorization URL `/api/proxies/${proxyName}/bridge/auth` |
| 29 | +- Token URL `/api/proxies/${proxyName}/bridge/token` |
| 30 | + |
| 31 | +All the "normal" oauth2 parameters like `clientId`, `clientSecrect` and so on must be define in your app. |
| 32 | +OAuth2-Bridge will forward them to the actual oAuth2 provider configured in the proxy. |
| 33 | + |
| 34 | +Only requests matching one of the configured redirect URIs are allowed. |
| 35 | + |
| 36 | +### Adding/Removing redirect URIs |
| 37 | + |
| 38 | +Of course you can add and remove redirect URIs manually via the web app. |
| 39 | + |
| 40 | +But you can also generate an API Token per Proxy. |
| 41 | +With this API Token you can add and remove redirect URIs per simple http call from your CI. |
| 42 | + |
| 43 | +To add a redirect URI via curl use |
| 44 | +`curl -H "Api-Token: <PROXY_API_TOKEN>" "<OAUTH2_BRIDGE_HOST>/api/proxies/<PROXY_NAME>/redirect-uri/add?redirectUri=<REDIRECT_URI_TO_ADD>"` |
| 45 | + |
| 46 | +To remove a redirect URI via curl use |
| 47 | +`curl -H "Api-Token: <PROXY_API_TOKEN>" "<OAUTH2_BRIDGE_HOST>/api/proxies/<PROXY_NAME>/redirect-uri/remove?redirectUri=<REDIRECT_URI_TO_ADD>"` |
0 commit comments