Skip to content

Commit 979a267

Browse files
feat: implement OIDC provider management in GraphQL API (#1563)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 96c120f commit 979a267

File tree

83 files changed

+7849
-516
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+7849
-516
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ typescript
7676
# Github actions
7777
RELEASE_NOTES.md
7878

79+
# Test backups
80+
api/dev/configs/api.json.backup
81+
7982
# Docker Deploy Folder
8083
deploy/*
8184
!deploy/.gitkeep

api/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ PATHS_RCLONE_SOCKET=./dev/rclone-socket
1717
PATHS_LOG_BASE=./dev/log # Where we store logs
1818
PATHS_LOGS_FILE=./dev/log/graphql-api.log
1919
PATHS_CONNECT_STATUS_FILE_PATH=./dev/connectStatus.json # Connect plugin status file
20+
PATHS_OIDC_JSON=./dev/configs/oidc.local.json
2021
ENVIRONMENT="development"
2122
NODE_ENV="development"
2223
PORT="3001"

api/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,8 @@ deploy/*
8686
# local api configs - don't need project-wide tracking
8787
dev/connectStatus.json
8888
dev/configs/*
89+
# local status - doesn't need to be tracked
90+
dev/connectStatus.json
91+
92+
# local OIDC config for testing - contains secrets
93+
dev/configs/oidc.local.json

api/dev/configs/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Development Configuration Files
2+
3+
This directory contains configuration files for local development.
4+
5+
## OIDC Configuration
6+
7+
### oidc.json
8+
The default OIDC configuration file. This file is committed to git and should only contain non-sensitive test configurations.
9+
10+
### Using a Local Configuration (gitignored)
11+
For local testing with real OAuth providers:
12+
13+
1. Create an `oidc.local.json` file based on `oidc.json`
14+
2. Set the environment variable: `PATHS_OIDC_JSON=./dev/configs/oidc.local.json`
15+
3. The API will load your local configuration instead of the default
16+
17+
Example:
18+
```bash
19+
PATHS_OIDC_JSON=./dev/configs/oidc.local.json pnpm dev
20+
```
21+
22+
### Setting up OAuth Apps
23+
24+
#### Google
25+
1. Go to [Google Cloud Console](https://console.cloud.google.com/)
26+
2. Create a new project or select existing
27+
3. Enable Google+ API
28+
4. Create OAuth 2.0 credentials
29+
5. Add authorized redirect URI: `http://localhost:3000/graphql/api/auth/oidc/callback`
30+
31+
#### GitHub
32+
1. Go to GitHub Settings > Developer settings > OAuth Apps
33+
2. Create a new OAuth App
34+
3. Set Authorization callback URL: `http://localhost:3000/graphql/api/auth/oidc/callback`

api/dev/configs/api.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"version": "4.12.0",
3-
"extraOrigins": [],
4-
"sandbox": true,
5-
"ssoSubIds": [],
6-
"plugins": ["unraid-api-plugin-connect"]
7-
}
2+
"version": "4.12.0",
3+
"extraOrigins": [],
4+
"sandbox": true,
5+
"ssoSubIds": [],
6+
"plugins": [
7+
"unraid-api-plugin-connect"
8+
]
9+
}

api/dev/configs/connect.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"wanaccess": true,
33
"wanport": 8443,
44
"upnpEnabled": false,
5-
"apikey": "_______________________BIG_API_KEY_HERE_________________________",
5+
"apikey": "",
66
"localApiKey": "_______________________LOCAL_API_KEY_HERE_________________________",
77
"email": "test@example.com",
88
"username": "zspearmint",
99
"avatar": "https://via.placeholder.com/200",
1010
"regWizTime": "1611175408732_0951-1653-3509-FBA155FA23C0",
11-
"dynamicRemoteAccessType": "DISABLED"
11+
"dynamicRemoteAccessType": "STATIC"
1212
}

api/dev/configs/oidc.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"providers": [
3+
{
4+
"id": "unraid.net",
5+
"name": "Unraid.net",
6+
"clientId": "CONNECT_SERVER_SSO",
7+
"issuer": "https://account.unraid.net",
8+
"authorizationEndpoint": "https://account.unraid.net/sso/",
9+
"tokenEndpoint": "https://account.unraid.net/api/oauth2/token",
10+
"scopes": [
11+
"openid",
12+
"profile",
13+
"email"
14+
],
15+
"authorizedSubIds": [
16+
"297294e2-b31c-4bcc-a441-88aee0ad609f"
17+
],
18+
"buttonText": "Login With Unraid.net"
19+
}
20+
]
21+
}
101 KB
Loading
95.5 KB
Loading
84.8 KB
Loading

0 commit comments

Comments
 (0)