Skip to content

Commit 35142bd

Browse files
committed
docs: replace OIDC provider examples with comprehensive setup guide
- Removed the outdated OIDC provider examples document. - Introduced a new OIDC provider setup guide detailing configuration steps for various providers. - Enhanced documentation includes authorization modes, troubleshooting tips, and security best practices. - Added new images to support the updated guide and improve user understanding.
1 parent c16d67c commit 35142bd

File tree

8 files changed

+392
-539
lines changed

8 files changed

+392
-539
lines changed
101 KB
Loading
95.5 KB
Loading
84.8 KB
Loading
128 KB
Loading
74.6 KB
Loading

api/docs/public/oidc-provider-examples.md

Lines changed: 0 additions & 533 deletions
This file was deleted.
Lines changed: 376 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,376 @@
1+
---
2+
title: OIDC Provider Setup
3+
description: Configure OIDC (OpenID Connect) providers for SSO authentication in Unraid API
4+
sidebar_position: 3
5+
---
6+
7+
# OIDC Provider Setup
8+
9+
This guide walks you through configuring OIDC (OpenID Connect) providers for SSO authentication in the Unraid API using the web interface.
10+
11+
## Accessing OIDC Settings
12+
13+
1. Navigate to your Unraid server's web interface
14+
2. The OIDC Providers section is available on the main configuration page
15+
3. You'll see tabs for different providers - click the **+** button to add a new provider
16+
17+
### OIDC Providers Interface Overview
18+
19+
![Login Page with SSO Options](./images/sso-with-options.png)
20+
_Screenshot: Login page showing traditional login form with SSO options - "Login With Unraid.net" and "Sign in with Google" buttons_
21+
22+
The interface includes:
23+
24+
- **Provider tabs**: Each configured provider (Unraid.net, Google, etc.) appears as a tab
25+
- **Add Provider button**: Click the **+** button to add new providers
26+
- **Authorization Mode dropdown**: Toggle between "simple" and "advanced" modes
27+
- **Simple Authorization section**: Configure allowed email domains and specific addresses
28+
- **Add Item buttons**: Click to add multiple authorization rules
29+
30+
## Understanding Authorization Modes
31+
32+
The interface provides two authorization modes:
33+
34+
### Simple Mode (Recommended)
35+
36+
Simple mode is the easiest way to configure authorization. You can:
37+
38+
- Allow specific email domains (e.g., @company.com)
39+
- Allow specific email addresses
40+
- Configure who can access your Unraid server with minimal setup
41+
42+
**When to use Simple Mode:**
43+
44+
- You want to allow all users from your company domain
45+
- You have a small list of specific users
46+
- You're new to OIDC configuration
47+
48+
<details>
49+
<summary><strong>Advanced Mode</strong></summary>
50+
51+
Advanced mode provides granular control using claim-based rules. You can:
52+
53+
- Create complex authorization rules based on JWT claims
54+
- Use operators like equals, contains, endsWith, startsWith
55+
- Combine multiple conditions with OR/AND logic
56+
- Choose whether ANY rule must pass (OR mode) or ALL rules must pass (AND mode)
57+
58+
**When to use Advanced Mode:**
59+
60+
- You need to check group memberships
61+
- You want to verify multiple claims (e.g., email domain AND verified status)
62+
- You have complex authorization requirements
63+
- You need fine-grained control over how rules are evaluated
64+
65+
</details>
66+
67+
## Authorization Rules
68+
69+
![Authorization Rules Configuration](./images/advanced-rules.png)
70+
_Screenshot: Advanced authorization rules showing JWT claim configuration with email endsWith operator for domain-based access control_
71+
72+
### Simple Mode Examples
73+
74+
#### Allow Company Domain
75+
76+
In Simple Authorization:
77+
78+
- **Allowed Email Domains**: Enter `company.com`
79+
- This allows anyone with @company.com email
80+
81+
#### Allow Specific Users
82+
83+
- **Specific Email Addresses**: Add individual emails
84+
- Click **Add Item** to add multiple addresses
85+
86+
<details>
87+
<summary><strong>Advanced Mode Examples</strong></summary>
88+
89+
#### Authorization Rule Mode
90+
91+
When using multiple rules, you can choose how they're evaluated:
92+
93+
- **OR Mode** (default): User is authorized if ANY rule passes
94+
- **AND Mode**: User is authorized only if ALL rules pass
95+
96+
#### Email Domain with Verification (AND Mode)
97+
98+
To require both email domain AND verification:
99+
100+
1. Set **Authorization Rule Mode** to `AND`
101+
2. Add two rules:
102+
- Rule 1:
103+
- **Claim**: `email`
104+
- **Operator**: `endsWith`
105+
- **Value**: `@company.com`
106+
- Rule 2:
107+
- **Claim**: `email_verified`
108+
- **Operator**: `equals`
109+
- **Value**: `true`
110+
111+
This ensures users must have both a company email AND a verified email address.
112+
113+
#### Group-Based Access (OR Mode)
114+
115+
To allow access to multiple groups:
116+
117+
1. Set **Authorization Rule Mode** to `OR` (default)
118+
2. Add rules for each group:
119+
- **Claim**: `groups`
120+
- **Operator**: `contains`
121+
- **Value**: `admins`
122+
123+
Or add another rule:
124+
- **Claim**: `groups`
125+
- **Operator**: `contains`
126+
- **Value**: `developers`
127+
128+
Users in either `admins` OR `developers` group will be authorized.
129+
130+
#### Multiple Domains
131+
132+
- **Claim**: `email`
133+
- **Operator**: `endsWith`
134+
- **Values**: Add multiple domains (e.g., `company.com`, `subsidiary.com`)
135+
136+
#### Complex Authorization (AND Mode)
137+
138+
For strict security requiring multiple conditions:
139+
140+
1. Set **Authorization Rule Mode** to `AND`
141+
2. Add multiple rules that ALL must pass:
142+
- Email must be from company domain
143+
- Email must be verified
144+
- User must be in specific group
145+
- Account must have 2FA enabled (if claim available)
146+
147+
</details>
148+
149+
<details>
150+
<summary><strong>Configuration Interface Details</strong></summary>
151+
152+
### Provider Tabs
153+
154+
- Each configured provider appears as a tab at the top
155+
- Click a tab to switch between provider configurations
156+
- The **+** button on the right adds a new provider
157+
158+
### Authorization Mode Dropdown
159+
160+
- **simple**: Best for email-based authorization (recommended for most users)
161+
- **advanced**: For complex claim-based rules using JWT claims
162+
163+
### Simple Authorization Fields
164+
165+
When "simple" mode is selected, you'll see:
166+
167+
- **Allowed Email Domains**: Enter domains without @ (e.g., `company.com`)
168+
- Helper text: "Users with emails ending in these domains can login"
169+
- **Specific Email Addresses**: Add individual email addresses
170+
- Helper text: "Only these exact email addresses can login"
171+
- **Add Item** buttons to add multiple entries
172+
173+
### Advanced Authorization Fields
174+
175+
When "advanced" mode is selected, you'll see:
176+
177+
- **Authorization Rule Mode**: Choose `OR` (any rule passes) or `AND` (all rules must pass)
178+
- **Authorization Rules**: Add multiple claim-based rules
179+
- **For each rule**:
180+
- **Claim**: The JWT claim to check
181+
- **Operator**: How to compare (equals, contains, endsWith, startsWith)
182+
- **Value**: What to match against
183+
184+
### Additional Interface Elements
185+
186+
- **Enable Developer Sandbox**: Toggle to enable GraphQL sandbox at `/graphql`
187+
- The interface uses a dark theme for better visibility
188+
- Field validation indicators help ensure correct configuration
189+
190+
</details>
191+
192+
### Required Redirect URI
193+
194+
All providers must be configured with this redirect URI:
195+
196+
```
197+
http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback
198+
```
199+
200+
Replace `YOUR_UNRAID_IP` with your actual server IP address.
201+
202+
### Issuer URL Format
203+
204+
The **Issuer URL** field accepts both formats, but **base URL is strongly recommended** for security:
205+
206+
- **Base URL** (recommended): `https://accounts.google.com`
207+
- **Full discovery URL**: `https://accounts.google.com/.well-known/openid-configuration`
208+
209+
**⚠️ Security Note**: Always use the base URL format when possible. The system automatically appends `/.well-known/openid-configuration` for OIDC discovery. Using the full discovery URL directly disables important issuer validation checks and is not recommended by the OpenID Connect specification.
210+
211+
**Examples of correct base URLs:**
212+
- Google: `https://accounts.google.com`
213+
- Microsoft/Azure: `https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0`
214+
- Keycloak: `https://keycloak.example.com/realms/YOUR_REALM`
215+
- Authelia: `https://auth.yourdomain.com`
216+
217+
## Testing Your Configuration
218+
219+
![Login Page with SSO Buttons](./images/sso-with-options.png)
220+
_Screenshot: Unraid login page displaying both traditional username/password authentication and SSO options with customized provider buttons_
221+
222+
1. Save your provider configuration
223+
2. Log out (if logged in)
224+
3. Navigate to the login page
225+
4. Your configured provider button should appear
226+
5. Click to test the login flow
227+
228+
## Troubleshooting
229+
230+
### Common Issues
231+
232+
#### "Provider not found" error
233+
234+
- Ensure the Issuer URL is correct
235+
- Check that the provider supports OIDC discovery (/.well-known/openid-configuration)
236+
237+
#### "Authorization failed"
238+
239+
- In Simple Mode: Check email domains are entered correctly (without @)
240+
- In Advanced Mode:
241+
- Verify claim names match exactly what your provider sends
242+
- Check if Authorization Rule Mode is set correctly (OR vs AND)
243+
- Ensure all required claims are present in the token
244+
- Enable debug logging to see actual claims and rule evaluation
245+
246+
#### "Invalid redirect URI"
247+
248+
- Ensure the redirect URI in your provider matches exactly
249+
- Include the port number (:3001)
250+
- Use HTTP for local, HTTPS for production
251+
252+
#### Cannot see login button
253+
254+
- Check that at least one authorization rule is configured
255+
- Verify the provider is enabled/saved
256+
257+
### Debug Mode
258+
259+
To troubleshoot issues:
260+
261+
1. Enable debug logging:
262+
263+
```bash
264+
LOG_LEVEL=debug unraid-api start --debug
265+
```
266+
267+
2. Check logs for:
268+
269+
- Received claims from provider
270+
- Authorization rule evaluation
271+
- Token validation errors
272+
273+
## Security Best Practices
274+
275+
1. **Always use HTTPS in production** - OAuth requires secure connections
276+
2. **Use Simple Mode for authorization** - Prevents overly accepting configurations and reduces misconfiguration risks
277+
3. **Be specific with authorization** - Don't use overly broad rules
278+
4. **Rotate secrets regularly** - Update client secrets periodically
279+
5. **Test thoroughly** - Verify only intended users can access
280+
281+
## Need Help?
282+
283+
- Check provider's OIDC documentation
284+
- Review Unraid API logs for detailed error messages
285+
- Ensure your provider supports standard OIDC discovery
286+
- Verify network connectivity between Unraid and provider
287+
288+
## Provider-Specific Setup
289+
290+
### Unraid.net Provider
291+
292+
The Unraid.net provider is built-in and pre-configured. You only need to configure authorization rules in the interface.
293+
294+
**Configuration:**
295+
- **Issuer URL**: Pre-configured (built-in provider)
296+
- **Client ID/Secret**: Pre-configured (built-in provider)
297+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
298+
299+
Configure authorization rules using Simple Mode (allowed email domains/addresses) or Advanced Mode for complex requirements.
300+
301+
### Google
302+
303+
Set up OAuth credentials in [Google Cloud Console](https://console.cloud.google.com/). Create a new OAuth client ID with Web application type.
304+
305+
**Configuration:**
306+
- **Issuer URL**: `https://accounts.google.com`
307+
- **Client ID/Secret**: From Google Cloud Console OAuth credentials
308+
- **Required Scopes**: `openid`, `profile`, `email`
309+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
310+
311+
For Google Workspace, use Advanced Mode with `hd` claim to restrict to your domain.
312+
313+
### Authelia
314+
315+
Configure OIDC client in your Authelia `configuration.yml` with client ID `unraid-api` and generate a hashed secret using the Authelia hash-password command.
316+
317+
**Configuration:**
318+
- **Issuer URL**: `https://auth.yourdomain.com`
319+
- **Client ID**: `unraid-api` (or as configured in Authelia)
320+
- **Client Secret**: Your unhashed secret
321+
- **Required Scopes**: `openid`, `profile`, `email`, `groups`
322+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
323+
324+
Use Advanced Mode with `groups` claim for group-based authorization.
325+
326+
### Microsoft/Azure AD
327+
328+
Register a new app in [Azure Portal](https://portal.azure.com/) under Azure Active Directory → App registrations. Note the Application ID, create a client secret, and note your tenant ID.
329+
330+
**Configuration:**
331+
- **Issuer URL**: `https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0`
332+
- **Client ID**: Your Application (client) ID
333+
- **Client Secret**: Generated client secret
334+
- **Required Scopes**: `openid`, `profile`, `email`
335+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
336+
337+
Authorization rules can be configured in the interface using email domains or advanced claims.
338+
339+
### Keycloak
340+
341+
Create a new confidential client in Keycloak Admin Console with `openid-connect` protocol and copy the client secret from the Credentials tab.
342+
343+
**Configuration:**
344+
- **Issuer URL**: `https://keycloak.example.com/realms/YOUR_REALM`
345+
- **Client ID**: `unraid-api` (or as configured in Keycloak)
346+
- **Client Secret**: From Keycloak Credentials tab
347+
- **Required Scopes**: `openid`, `profile`, `email`
348+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
349+
350+
For role-based authorization, use Advanced Mode with `realm_access.roles` or `resource_access` claims.
351+
352+
### Authentik
353+
354+
Create a new OAuth2/OpenID Provider in Authentik, then create an Application and link it to the provider.
355+
356+
**Configuration:**
357+
- **Issuer URL**: `https://authentik.example.com/application/o/unraid-api/`
358+
- **Client ID**: From Authentik provider configuration
359+
- **Client Secret**: From Authentik provider configuration
360+
- **Required Scopes**: `openid`, `profile`, `email`
361+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
362+
363+
Authorization rules can be configured in the interface.
364+
365+
### Okta
366+
367+
Create a new OIDC Web Application in Okta Admin Console and assign appropriate users or groups.
368+
369+
**Configuration:**
370+
- **Issuer URL**: `https://YOUR_DOMAIN.okta.com`
371+
- **Client ID**: From Okta application configuration
372+
- **Client Secret**: From Okta application configuration
373+
- **Required Scopes**: `openid`, `profile`, `email`
374+
- **Redirect URI**: `http://YOUR_UNRAID_IP:3001/graphql/api/auth/oidc/callback`
375+
376+
Authorization rules can be configured in the interface using email domains or advanced claims.

0 commit comments

Comments
 (0)