diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs deleted file mode 100644 index b25a562..0000000 --- a/docs/.vitepress/config.mjs +++ /dev/null @@ -1,89 +0,0 @@ -import { defineConfig } from 'vitepress' - -// https://vitepress.dev/reference/site-config -export default defineConfig({ - title: "AuthentiKate", - description: "A lightweight SSO/OIDC solution built for homelabbers", - head: [ - ['meta', { name: 'theme-color', content: '#3b82f6' }], - ], - themeConfig: { - // https://vitepress.dev/reference/default-theme-config - logo: '/logo.svg', - - nav: [ - { text: 'Home', link: '/' }, - { text: 'Guide', link: '/guide/installation' }, - { text: 'Configuration', link: '/config/environment' }, - { text: 'Integrations', link: '/integrations/overview' } - ], - - sidebar: { - '/guide/': [ - { - text: 'Getting Started', - items: [ - { text: 'Installation', link: '/guide/installation' }, - { text: 'Quick Start', link: '/guide/quick-start' }, - { text: 'First Setup', link: '/guide/first-setup' } - ] - }, - { - text: 'User Management', - items: [ - { text: 'Creating Users', link: '/guide/users' }, - { text: 'Invitations', link: '/guide/invitations' }, - { text: 'User Profiles', link: '/guide/profiles' } - ] - }, - { - text: 'Applications', - items: [ - { text: 'Managing Apps', link: '/guide/applications' }, - { text: 'OAuth Configuration', link: '/guide/oauth' } - ] - } - ], - '/config/': [ - { - text: 'Configuration', - items: [ - { text: 'Environment Variables', link: '/config/environment' }, - { text: 'Database Setup', link: '/config/database' }, - { text: 'Security Settings', link: '/config/security' }, - { text: 'Email Configuration', link: '/config/email' } - ] - } - ], - '/integrations/': [ - { - text: 'Integrations', - items: [ - { text: 'Overview', link: '/integrations/overview' }, - { text: 'Grafana', link: '/integrations/grafana' }, - { text: 'Nextcloud', link: '/integrations/nextcloud' }, - { text: 'Traefik', link: '/integrations/traefik' }, - { text: 'Other Applications', link: '/integrations/generic' } - ] - } - ] - }, - - socialLinks: [ - { icon: 'github', link: 'https://github.com/jdubpark/authentikate' } - ], - - footer: { - message: 'Released under the MIT License.', - copyright: 'Copyright © 2024-present AuthentiKate' - }, - - editLink: { - pattern: 'https://github.com/jdubpark/authentikate/edit/main/docs/:path' - }, - - search: { - provider: 'local' - } - } -}) diff --git a/docs/config/email.md b/docs/config/email.md deleted file mode 100644 index c09ce0f..0000000 --- a/docs/config/email.md +++ /dev/null @@ -1,360 +0,0 @@ -# Email Configuration - -Email is essential for user invitations, password resets, and account verification. This guide covers how to configure email in AuthentiKate. - -## Why Email Matters - -Email is used for: -- **User Invitations**: Send registration links to new users -- **Password Resets**: Allow users to reset forgotten passwords -- **Email Verification**: Verify user email addresses -- **Account Notifications**: Security alerts and updates - -## Basic SMTP Configuration - -Set these environment variables for SMTP email: - -```bash -MAIL_MAILER=smtp -MAIL_HOST=your-smtp-server.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@domain.com -MAIL_PASSWORD=your-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -## Provider-Specific Configurations - -### Gmail - -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.gmail.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@gmail.com -MAIL_PASSWORD=your-app-password # Not your regular Gmail password! -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=your-email@gmail.com -MAIL_FROM_NAME="Your Name" -``` - -**Important**: Use an [App Password](https://support.google.com/accounts/answer/185833), not your regular Gmail password. - -#### Creating Gmail App Password -1. Enable 2-Factor Authentication on your Google account -2. Go to **Google Account** → **Security** → **App passwords** -3. Generate a new app password for "Mail" -4. Use this 16-character password in `MAIL_PASSWORD` - -### Outlook/Hotmail - -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp-mail.outlook.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@outlook.com -MAIL_PASSWORD=your-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=your-email@outlook.com -MAIL_FROM_NAME="Your Name" -``` - -### Custom Domain Email - -If you have your own domain with email hosting: - -```bash -MAIL_MAILER=smtp -MAIL_HOST=mail.yourdomain.com -MAIL_PORT=587 -MAIL_USERNAME=auth@yourdomain.com -MAIL_PASSWORD=your-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -## Email Service Providers - -### SendGrid - -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.sendgrid.net -MAIL_PORT=587 -MAIL_USERNAME=apikey -MAIL_PASSWORD=your-sendgrid-api-key -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -### Mailgun - -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.mailgun.org -MAIL_PORT=587 -MAIL_USERNAME=your-mailgun-username -MAIL_PASSWORD=your-mailgun-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -### Amazon SES - -```bash -MAIL_MAILER=smtp -MAIL_HOST=email-smtp.us-east-1.amazonaws.com # Change region as needed -MAIL_PORT=587 -MAIL_USERNAME=your-ses-smtp-username -MAIL_PASSWORD=your-ses-smtp-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -### Postmark - -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.postmarkapp.com -MAIL_PORT=587 -MAIL_USERNAME=your-postmark-token -MAIL_PASSWORD=your-postmark-token -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -## Docker Compose Configuration - -### Environment Variables - -```yaml -services: - authentikate: - image: authentikate/authentikate:latest - environment: - # Gmail example - MAIL_MAILER: smtp - MAIL_HOST: smtp.gmail.com - MAIL_PORT: 587 - MAIL_USERNAME: your-email@gmail.com - MAIL_PASSWORD: your-app-password - MAIL_ENCRYPTION: tls - MAIL_FROM_ADDRESS: your-email@gmail.com - MAIL_FROM_NAME: "AuthentiKate" -``` - -### Environment File - -Create a `.env` file: - -```bash -# Email configuration -MAIL_MAILER=smtp -MAIL_HOST=smtp.gmail.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@gmail.com -MAIL_PASSWORD=your-app-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=your-email@gmail.com -MAIL_FROM_NAME="AuthentiKate" -``` - -Reference it in docker-compose.yml: - -```yaml -services: - authentikate: - image: authentikate/authentikate:latest - env_file: .env -``` - -## Testing Email Configuration - -### Send Test Email - -AuthentiKate includes a command to test email sending: - -```bash -# Test email configuration -docker exec -it authentikate php artisan tinker - -# In the tinker console: -Mail::raw('Test email from AuthentiKate', function($message) { - $message->to('test@example.com')->subject('Test Email'); -}); -``` - -### Check Logs - -If emails aren't sending, check the logs: - -```bash -# View container logs -docker logs authentikate - -# Look for email-related errors -docker logs authentikate 2>&1 | grep -i mail -``` - -## Advanced Configuration - -### Custom SMTP Port - -Some providers use different ports: - -```bash -# Standard ports -MAIL_PORT=25 # Unencrypted (not recommended) -MAIL_PORT=587 # STARTTLS (recommended) -MAIL_PORT=465 # SSL/TLS - -# Custom port -MAIL_PORT=2525 # Some providers use alternate ports -``` - -### SSL/TLS Configuration - -```bash -# Use TLS (recommended) -MAIL_ENCRYPTION=tls - -# Use SSL (older, but still secure) -MAIL_ENCRYPTION=ssl - -# No encryption (not recommended) -MAIL_ENCRYPTION=null -``` - -### Multiple From Addresses - -Configure different senders for different email types: - -```bash -# Default sender -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" - -# Admin notifications (configure in application) -ADMIN_EMAIL_FROM=admin@yourdomain.com -ADMIN_EMAIL_NAME="AuthentiKate Admin" -``` - -## Email Templates - -AuthentiKate uses customizable email templates for different purposes: - -### Invitation Email -- **Subject**: "You're invited to join AuthentiKate" -- **Content**: Welcome message with registration link -- **Action**: "Complete Registration" button - -### Password Reset -- **Subject**: "Reset your AuthentiKate password" -- **Content**: Instructions for password reset -- **Action**: "Reset Password" button - -### Email Verification -- **Subject**: "Verify your email address" -- **Content**: Verification instructions -- **Action**: "Verify Email" button - -## Troubleshooting - -### Common Issues - -#### "Connection could not be established" -``` -Swift_TransportException: Connection could not be established -``` - -**Solutions**: -- Check SMTP server address and port -- Verify firewall isn't blocking SMTP ports -- Try different encryption settings (TLS vs SSL) - -#### "Authentication failed" -``` -Swift_TransportException: Expected response code 235 but got code "535" -``` - -**Solutions**: -- Verify username and password -- Use App Password for Gmail -- Check if 2FA is enabled and requires app password - -#### "From address not allowed" -``` -Message: From address not allowed -``` - -**Solutions**: -- Ensure `MAIL_FROM_ADDRESS` matches authenticated user -- Configure your email provider to allow sending from this address -- Use provider's verified domain - -### Debug Mode - -Enable email debugging: - -```bash -# Add to environment -LOG_LEVEL=debug -MAIL_LOG_CHANNEL=single - -# Check detailed logs -docker logs authentikate | grep -i mail -``` - -### Test with Different Providers - -If one provider doesn't work, try another: - -```bash -# Try Gmail first (easiest to set up) -MAIL_HOST=smtp.gmail.com - -# Then try SendGrid (good for production) -MAIL_HOST=smtp.sendgrid.net - -# Or use a transactional service -MAIL_HOST=smtp.mailgun.org -``` - -## Production Recommendations - -### Dedicated Email Service -For production, use a dedicated email service: -- **SendGrid**: Easy setup, good deliverability -- **Mailgun**: Reliable, detailed analytics -- **Amazon SES**: Cost-effective, AWS integration -- **Postmark**: Fast delivery, great for transactional emails - -### Domain Authentication -Set up SPF, DKIM, and DMARC records: - -```dns -# SPF record -yourdomain.com. TXT "v=spf1 include:_spf.google.com ~all" - -# DKIM (provided by email service) -default._domainkey.yourdomain.com. TXT "v=DKIM1; k=rsa; p=..." - -# DMARC -_dmarc.yourdomain.com. TXT "v=DMARC1; p=quarantine; rua=mailto:dmarc@yourdomain.com" -``` - -### Monitoring -Monitor email delivery: -- Track bounce rates -- Monitor spam complaints -- Watch delivery statistics -- Set up alerts for failures - -Your email configuration is now ready! Users will receive professional-looking emails for invitations, password resets, and other notifications. \ No newline at end of file diff --git a/docs/config/environment.md b/docs/config/environment.md deleted file mode 100644 index b1a3825..0000000 --- a/docs/config/environment.md +++ /dev/null @@ -1,402 +0,0 @@ -# Environment Variables - -AuthentiKate is configured through environment variables. This page covers all available configuration options. - -## Core Application Settings - -### APP_URL -**Required** - The URL where AuthentiKate is accessible. - -```bash -APP_URL=https://auth.yourdomain.com -``` - -::: warning -This URL must match exactly how users access AuthentiKate. OAuth redirects and JWT tokens depend on this value. -::: - -### APP_ENV -**Default**: `production` - -```bash -APP_ENV=production # or 'local' for development -``` - -### APP_DEBUG -**Default**: `false` - -```bash -APP_DEBUG=false # Set to 'true' only for debugging -``` - -::: danger -Never set `APP_DEBUG=true` in production as it exposes sensitive information. -::: - -### APP_KEY -**Auto-generated** - Laravel application key for encryption. - -```bash -APP_KEY=base64:generated-key-here -``` - -The key is automatically generated on first run. Do not change this after deployment as it will invalidate existing sessions and tokens. - -## Database Configuration - -### SQLite (Default) - -```bash -DB_CONNECTION=sqlite -DB_DATABASE=/var/www/html/storage/database/database.sqlite -``` - -### PostgreSQL - -```bash -DB_CONNECTION=pgsql -DB_HOST=postgres -DB_PORT=5432 -DB_DATABASE=authentikate -DB_USERNAME=authentikate -DB_PASSWORD=secure_password -``` - -### MySQL/MariaDB - -```bash -DB_CONNECTION=mysql -DB_HOST=mysql -DB_PORT=3306 -DB_DATABASE=authentikate -DB_USERNAME=authentikate -DB_PASSWORD=secure_password -``` - -## Email Configuration - -Email is used for user invitations, password resets, and verification. - -### SMTP - -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.gmail.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@gmail.com -MAIL_PASSWORD=your-app-password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="AuthentiKate" -``` - -### Common SMTP Providers - -#### Gmail -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.gmail.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@gmail.com -MAIL_PASSWORD=your-app-password # Use App Password, not regular password -MAIL_ENCRYPTION=tls -``` - -#### Outlook/Hotmail -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp-mail.outlook.com -MAIL_PORT=587 -MAIL_USERNAME=your-email@outlook.com -MAIL_PASSWORD=your-password -MAIL_ENCRYPTION=tls -``` - -#### SendGrid -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.sendgrid.net -MAIL_PORT=587 -MAIL_USERNAME=apikey -MAIL_PASSWORD=your-sendgrid-api-key -MAIL_ENCRYPTION=tls -``` - -#### Mailgun -```bash -MAIL_MAILER=smtp -MAIL_HOST=smtp.mailgun.org -MAIL_PORT=587 -MAIL_USERNAME=your-mailgun-username -MAIL_PASSWORD=your-mailgun-password -MAIL_ENCRYPTION=tls -``` - -### Disable Email -```bash -MAIL_MAILER=log # Emails will be written to logs instead of sent -``` - -## Cache Configuration - -### Redis (Recommended for Production) - -```bash -CACHE_DRIVER=redis -REDIS_HOST=redis -REDIS_PORT=6379 -REDIS_PASSWORD=your-redis-password -``` - -### File Cache (Default) - -```bash -CACHE_DRIVER=file -``` - -### Database Cache - -```bash -CACHE_DRIVER=database -``` - -## Session Configuration - -### Redis Sessions (Recommended for Production) - -```bash -SESSION_DRIVER=redis -SESSION_LIFETIME=120 # Minutes -``` - -### File Sessions (Default) - -```bash -SESSION_DRIVER=file -SESSION_LIFETIME=120 -``` - -### Database Sessions - -```bash -SESSION_DRIVER=database -``` - -## Security Settings - -### SSL/HTTPS - -```bash -# Force HTTPS redirects -FORCE_HTTPS=true - -# Set secure cookie settings -SESSION_SECURE_COOKIE=true -SANCTUM_STATEFUL_DOMAINS=auth.yourdomain.com -``` - -### CORS Configuration - -```bash -# Allow CORS for your domains -CORS_ALLOWED_ORIGINS=https://yourdomain.com,https://app.yourdomain.com -``` - -## Logging - -### Log Level - -```bash -LOG_LEVEL=info # debug, info, notice, warning, error, critical, alert, emergency -``` - -### Log Channel - -```bash -LOG_CHANNEL=stack # single, daily, slack, syslog, errorlog -``` - -### Daily Log Rotation - -```bash -LOG_CHANNEL=daily -LOG_DAILY_DAYS=14 # Keep logs for 14 days -``` - -## Queue Configuration - -For background job processing: - -### Redis Queue - -```bash -QUEUE_CONNECTION=redis -``` - -### Database Queue - -```bash -QUEUE_CONNECTION=database -``` - -### Sync Queue (Default) - -```bash -QUEUE_CONNECTION=sync # Process jobs immediately -``` - -## OAuth/OIDC Settings - -### Token Lifetimes - -```bash -# Access token lifetime (in minutes) -OAUTH_ACCESS_TOKEN_LIFETIME=60 - -# Refresh token lifetime (in days) -OAUTH_REFRESH_TOKEN_LIFETIME=30 - -# Authorization code lifetime (in minutes) -OAUTH_AUTHORIZATION_CODE_LIFETIME=10 -``` - -### JWT Configuration - -```bash -# JWT algorithm (default: RS256) -JWT_ALGORITHM=RS256 - -# Key paths (automatically set) -OAUTH_PRIVATE_KEY_PATH=storage/oauth/private.pem -OAUTH_PUBLIC_KEY_PATH=storage/oauth/public.pem -``` - -## Performance Settings - -### PHP Configuration - -```bash -# Memory limit -PHP_MEMORY_LIMIT=256M - -# Upload limits -PHP_UPLOAD_MAX_FILESIZE=10M -PHP_POST_MAX_SIZE=10M - -# Execution time -PHP_MAX_EXECUTION_TIME=300 -``` - -### Application Optimization - -```bash -# Enable optimizations for production -APP_OPTIMIZE=true - -# Cache configuration -CONFIG_CACHE=true -ROUTE_CACHE=true -VIEW_CACHE=true -``` - -## Development Settings - -These should only be used in development environments: - -```bash -APP_ENV=local -APP_DEBUG=true -LOG_LEVEL=debug - -# Disable HTTPS for local development -FORCE_HTTPS=false -SESSION_SECURE_COOKIE=false -``` - -## Complete Production Example - -Here's a complete environment configuration for production: - -```bash -# Application -APP_ENV=production -APP_DEBUG=false -APP_URL=https://auth.yourdomain.com -FORCE_HTTPS=true - -# Database -DB_CONNECTION=pgsql -DB_HOST=postgres -DB_DATABASE=authentikate -DB_USERNAME=authentikate -DB_PASSWORD=secure_database_password - -# Email -MAIL_MAILER=smtp -MAIL_HOST=smtp.gmail.com -MAIL_PORT=587 -MAIL_USERNAME=auth@yourdomain.com -MAIL_PASSWORD=gmail_app_password -MAIL_ENCRYPTION=tls -MAIL_FROM_ADDRESS=auth@yourdomain.com -MAIL_FROM_NAME="Your Company Auth" - -# Cache & Sessions -CACHE_DRIVER=redis -SESSION_DRIVER=redis -REDIS_HOST=redis -REDIS_PASSWORD=secure_redis_password - -# Security -SESSION_SECURE_COOKIE=true -SESSION_LIFETIME=120 -SANCTUM_STATEFUL_DOMAINS=yourdomain.com - -# Performance -LOG_LEVEL=warning -LOG_CHANNEL=daily -LOG_DAILY_DAYS=30 -``` - -## Docker Compose Integration - -Add environment variables to your `docker-compose.yml`: - -```yaml -services: - authentikate: - image: authentikate/authentikate:latest - environment: - - APP_URL=https://auth.yourdomain.com - - APP_ENV=production - - DB_CONNECTION=pgsql - - DB_HOST=postgres - - MAIL_MAILER=smtp - - MAIL_HOST=smtp.gmail.com - # ... other variables - env_file: - - .env # Or load from file -``` - -## Environment File - -Create a `.env` file for easier management: - -```bash -# Create environment file -cat > .env << 'EOF' -APP_URL=https://auth.yourdomain.com -APP_ENV=production -DB_CONNECTION=pgsql -# ... other settings -EOF - -# Reference in docker-compose.yml -services: - authentikate: - env_file: .env -``` - -::: tip -Keep your `.env` file secure and never commit it to version control. -::: \ No newline at end of file diff --git a/docs/guide/applications.md b/docs/guide/applications.md deleted file mode 100644 index 6e6e800..0000000 --- a/docs/guide/applications.md +++ /dev/null @@ -1,188 +0,0 @@ -# Managing Applications - -Learn how to create and manage OAuth applications in AuthentiKate. - -## Creating Applications - -### Via Web Interface - -1. **Navigate** to **Applications** in the admin panel -2. **Click** "Create Application" -3. **Fill in** the application details: - - **Name**: Display name for your application - - **Redirect URI**: OAuth callback URL - - **Icon**: Optional icon URL for the application -4. **Save** the application - -### Application Details - -Each application gets: -- **Unique Client ID**: Public identifier for your application -- **Client Secret**: Private key for token exchange -- **Redirect URI**: Where users return after authentication - -::: warning -Keep your Client Secret secure! It should never be exposed in client-side code. -::: - -## Application Templates - -AuthentiKate includes templates for popular applications: - -### Available Templates -- **Grafana**: Analytics and monitoring -- **Nextcloud**: File sharing and collaboration -- **Proxmox**: Virtualization management -- **Portainer**: Docker container management -- **GitLab**: Git repository hosting - -Templates automatically configure: -- Correct redirect URI patterns -- Appropriate application icons -- Common configuration settings - -## OAuth Configuration - -### Client Credentials -```yaml -Client ID: f47ac10b-58cc-4372-a567-0e02b2c3d479 -Client Secret: 40-character-random-string -``` - -### Endpoints -Your applications will use these endpoints: -- **Authorization**: `/oauth/authorize` -- **Token**: `/oauth/token` -- **User Info**: `/oauth/userinfo` -- **JWKS**: `/.well-known/jwks.json` - -### Supported Features -- **Authorization Code Flow**: Standard OAuth2 flow -- **PKCE**: Enhanced security for public clients -- **JWT Tokens**: Signed with RSA256 -- **Refresh Tokens**: Long-lived token renewal - -## Security Best Practices - -### Redirect URI Validation -- Use exact URI matching -- Always use HTTPS in production -- Avoid wildcard redirects - -### Client Secret Management -- Store secrets securely -- Rotate secrets regularly -- Use different secrets per environment - -### Token Handling -- Validate token signatures -- Respect token expiration -- Implement proper logout - -## Common Integration Patterns - -### Server-Side Applications -Best for applications that can securely store client secrets: - -```javascript -// Example: Node.js application -const config = { - clientId: 'your-client-id', - clientSecret: 'your-client-secret', - authorizationURL: 'https://auth.yourdomain.com/oauth/authorize', - tokenURL: 'https://auth.yourdomain.com/oauth/token', - callbackURL: 'https://yourapp.com/auth/callback' -}; -``` - -### Single Page Applications (SPA) -For client-side applications using PKCE: - -```javascript -// Example: React application with PKCE -const config = { - clientId: 'your-client-id', - // No client secret for public clients - authorizationURL: 'https://auth.yourdomain.com/oauth/authorize', - tokenURL: 'https://auth.yourdomain.com/oauth/token', - redirectUri: 'https://yourapp.com/callback', - usePKCE: true -}; -``` - -### Mobile Applications -Similar to SPAs, always use PKCE: - -```swift -// Example: iOS Swift -let config = OIDServiceConfiguration( - authorizationEndpoint: URL(string: "https://auth.yourdomain.com/oauth/authorize")!, - tokenEndpoint: URL(string: "https://auth.yourdomain.com/oauth/token")! -) -``` - -## Testing Applications - -### Manual Testing -1. **Start OAuth flow** from your application -2. **Verify redirect** to AuthentiKate -3. **Complete authentication** -4. **Confirm successful** return to your app -5. **Check user data** is populated correctly - -### Automated Testing -```bash -# Test authorization endpoint -curl "https://auth.yourdomain.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code&scope=openid" - -# Test token exchange (after getting auth code) -curl -X POST https://auth.yourdomain.com/oauth/token \ - -H "Content-Type: application/x-www-form-urlencoded" \ - -d "grant_type=authorization_code&code=AUTH_CODE&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&redirect_uri=REDIRECT_URI" -``` - -## Troubleshooting - -### Invalid Redirect URI -**Error**: `The redirect URI is invalid` - -**Solutions**: -- Verify exact URL match in application settings -- Check for trailing slashes -- Ensure HTTPS is used - -### Invalid Client -**Error**: `Client authentication failed` - -**Solutions**: -- Verify Client ID and Secret -- Check that application exists and is active -- Ensure secrets haven't been regenerated - -### Token Validation Issues -**Error**: `Invalid token signature` - -**Solutions**: -- Use JWKS endpoint for signature validation -- Verify token hasn't expired -- Check token issuer matches AuthentiKate URL - -## Application Management - -### Updating Applications -- **Edit** application details anytime -- **Regenerate** client secrets if compromised -- **Update** redirect URIs for new environments - -### Deactivating Applications -- **Disable** applications to prevent new logins -- Existing tokens remain valid until expiration -- **Re-enable** anytime to restore access - -### Monitoring Usage -View application usage in the admin panel: -- **Active tokens** per application -- **Recent authentications** -- **User access patterns** - -Your applications are now ready for OAuth integration with AuthentiKate! \ No newline at end of file diff --git a/docs/guide/first-setup.md b/docs/guide/first-setup.md deleted file mode 100644 index b0225f5..0000000 --- a/docs/guide/first-setup.md +++ /dev/null @@ -1,202 +0,0 @@ -# First Setup - -After installing AuthentiKate, you'll want to complete the initial configuration to make it ready for production use. - -## Initial Login - -When you first start AuthentiKate, it automatically creates an admin user. The credentials are shown in the container logs: - -```bash -docker logs authentikate -``` - -Look for: -``` -✅ Initial admin user created: - Email: admin@authentikate.local - Password: randomly-generated-password -``` - -::: tip -Save these credentials securely! You'll need them to access the admin interface. -::: - -## Admin Dashboard - -After logging in, you'll see the AuthentiKate dashboard with: - -- **Applications**: Manage OAuth applications -- **Users**: User management and invitations -- **Tokens**: View active authentication tokens -- **Profile**: Your user profile settings - -## Essential Configuration Steps - -### 1. Update Your Profile - -1. Click your avatar in the top right -2. Select **"Profile"** -3. Update your information: - - Change the email from `admin@authentikate.local` to your real email - - Set a preferred username - - Upload an avatar (optional) - - **Change your password** to something secure - -### 2. Configure Email (Recommended) - -Email is used for: -- User invitations -- Password resets -- Account verification - -Set up email by updating your environment variables: - -```yaml -environment: - MAIL_MAILER: smtp - MAIL_HOST: smtp.gmail.com - MAIL_PORT: 587 - MAIL_USERNAME: your-email@gmail.com - MAIL_PASSWORD: your-app-password - MAIL_ENCRYPTION: tls - MAIL_FROM_ADDRESS: auth@yourdomain.com - MAIL_FROM_NAME: "AuthentiKate" -``` - -[→ See full email configuration guide](/config/email) - -### 3. Set Your Domain - -Update the `APP_URL` to match your actual domain: - -```yaml -environment: - APP_URL: https://auth.yourdomain.com -``` - -This ensures: -- Correct OAuth redirect URLs -- Proper JWT issuer claims -- Working email links - -### 4. Create Your First Application - -1. Go to **Applications** → **Create Application** -2. Fill in the basic information: - - **Name**: Your application name (e.g., "Grafana") - - **Redirect URI**: Where users return after authentication - - **Icon**: Optional app icon URL - -3. Note the generated **Client ID** and **Client Secret** -4. Use these in your application's OAuth configuration - -## Security Checklist - -Before going to production, verify these security settings: - -### ✅ Admin Account -- [ ] Changed default admin email -- [ ] Set a strong, unique password -- [ ] Enabled email verification (if email is configured) - -### ✅ Environment -- [ ] Set `APP_ENV=production` -- [ ] Set `APP_DEBUG=false` -- [ ] Using HTTPS with valid SSL certificate -- [ ] `APP_URL` matches your actual domain - -### ✅ Database -- [ ] Using persistent volume for data -- [ ] Consider using PostgreSQL/MySQL for production -- [ ] Regular backups configured - -### ✅ Reverse Proxy -- [ ] Proper SSL termination -- [ ] Security headers configured -- [ ] Rate limiting in place - -## Application Integration - -### OIDC Endpoints - -Your applications will need these endpoints: - -| Endpoint | URL | -|----------|-----| -| Authorization | `https://auth.yourdomain.com/oauth/authorize` | -| Token | `https://auth.yourdomain.com/oauth/token` | -| User Info | `https://auth.yourdomain.com/oauth/userinfo` | -| JWKS | `https://auth.yourdomain.com/.well-known/jwks.json` | -| Discovery | `https://auth.yourdomain.com/.well-known/openid_configuration` | - -### OAuth Flow - -1. **User clicks login** in your application -2. **Redirect to AuthentiKate** with authorization request -3. **User authenticates** (if not already logged in) -4. **User consents** to application access (if required) -5. **Redirect back** to your application with authorization code -6. **Exchange code** for access token and ID token -7. **Access user info** using the access token - -## User Management - -### Invitation System - -AuthentiKate uses an invitation-based registration system: - -1. **Admin creates invitation** with user's email -2. **Invitation email sent** with registration link -3. **User completes registration** using the invitation -4. **User can access applications** they're authorized for - -### User Permissions - -- **Admin users**: Full access to manage applications and users -- **Regular users**: Can only access authorized applications and manage their own profile - -## Backup Strategy - -Set up regular backups of your AuthentiKate data: - -### SQLite (Default) -```bash -# Daily backup script -#!/bin/bash -docker exec authentikate cp /var/www/html/storage/database/database.sqlite /tmp/backup.sqlite -docker cp authentikate:/tmp/backup.sqlite ./backups/authentikate-$(date +%Y%m%d).sqlite -``` - -### Full Volume Backup -```bash -# Backup all persistent data -docker run --rm -v authentikate_data:/data -v $(pwd)/backups:/backup alpine tar czf /backup/authentikate-full-$(date +%Y%m%d).tar.gz -C /data . -``` - -## Common Next Steps - -### Popular Integrations -- [Set up Grafana SSO](/integrations/grafana) -- [Configure Nextcloud authentication](/integrations/nextcloud) -- [Integrate with Traefik forward auth](/integrations/traefik) - -### Advanced Configuration -- [Environment variables reference](/config/environment) -- [Database configuration](/config/database) -- [Security settings](/config/security) - -### User Management -- [Create user invitations](/guide/invitations) -- [Manage user profiles](/guide/profiles) -- [Handle user permissions](/guide/users) - -## Getting Help - -If you run into issues: - -1. **Check the logs**: `docker logs authentikate` -2. **Verify configuration**: Compare with working examples -3. **Test endpoints**: Use curl or Postman to test OIDC endpoints -4. **Community support**: Check GitHub issues and discussions - -Your AuthentiKate instance is now ready for production use! 🎉 \ No newline at end of file diff --git a/docs/guide/installation.md b/docs/guide/installation.md deleted file mode 100644 index 0d2d914..0000000 --- a/docs/guide/installation.md +++ /dev/null @@ -1,259 +0,0 @@ -# Installation - -AuthentiKate is designed to be deployed easily with Docker, making it perfect for homelab environments. This guide will walk you through different installation methods. - -## Quick Start with Docker - -The fastest way to get AuthentiKate running is with Docker: - -```bash -docker run -d \ - --name authentikate \ - -p 8080:8080 \ - -e APP_URL=http://localhost:8080 \ - -v authentikate_data:/var/www/html/storage \ - authentikate/authentikate:latest -``` - -AuthentiKate will be available at `http://localhost:8080` with automatic setup completing in the background. - -## Docker Compose (Recommended) - -For production use, we recommend using Docker Compose for better configuration management: - -```yaml -version: '3.8' - -services: - authentikate: - image: authentikate/authentikate:latest - container_name: authentikate - restart: unless-stopped - ports: - - "8080:8080" - environment: - # Required - APP_URL: https://auth.yourdomain.com - APP_ENV: production - - # Database (SQLite by default) - DB_CONNECTION: sqlite - - # Email (optional but recommended) - MAIL_MAILER: smtp - MAIL_HOST: your-smtp-server.com - MAIL_PORT: 587 - MAIL_USERNAME: your-email@domain.com - MAIL_PASSWORD: your-password - MAIL_ENCRYPTION: tls - MAIL_FROM_ADDRESS: auth@yourdomain.com - MAIL_FROM_NAME: "AuthentiKate" - - volumes: - - authentikate_data:/var/www/html/storage - - authentikate_logs:/var/www/html/storage/logs - - # Optional: Use external database - # depends_on: - # - postgres - - labels: - # Traefik labels (if using Traefik) - - "traefik.enable=true" - - "traefik.http.routers.authentikate.rule=Host(`auth.yourdomain.com`)" - - "traefik.http.routers.authentikate.entrypoints=websecure" - - "traefik.http.routers.authentikate.tls.certresolver=letsencrypt" - - "traefik.http.services.authentikate.loadbalancer.server.port=8080" - -volumes: - authentikate_data: - authentikate_logs: -``` - -## Environment Variables - -### Required Variables - -| Variable | Description | Example | -|----------|-------------|---------| -| `APP_URL` | The URL where AuthentiKate will be accessible | `https://auth.yourdomain.com` | - -### Optional Variables - -| Variable | Default | Description | -|----------|---------|-------------| -| `APP_ENV` | `production` | Application environment | -| `APP_DEBUG` | `false` | Enable debug mode | -| `DB_CONNECTION` | `sqlite` | Database type (`sqlite`, `mysql`, `postgres`) | -| `DB_DATABASE` | `/var/www/html/storage/database/database.sqlite` | Database path/name | - -## Database Options - -### SQLite (Default) -Perfect for most homelab setups. No additional configuration required. - -### PostgreSQL -For larger installations: - -```yaml -services: - postgres: - image: postgres:15 - environment: - POSTGRES_DB: authentikate - POSTGRES_USER: authentikate - POSTGRES_PASSWORD: secure_password - volumes: - - postgres_data:/var/lib/postgresql/data - - authentikate: - # ... other config - environment: - DB_CONNECTION: pgsql - DB_HOST: postgres - DB_DATABASE: authentikate - DB_USERNAME: authentikate - DB_PASSWORD: secure_password - depends_on: - - postgres - -volumes: - postgres_data: -``` - -### MySQL/MariaDB -```yaml -services: - mysql: - image: mariadb:10 - environment: - MYSQL_DATABASE: authentikate - MYSQL_USER: authentikate - MYSQL_PASSWORD: secure_password - MYSQL_ROOT_PASSWORD: root_password - volumes: - - mysql_data:/var/lib/mysql - - authentikate: - # ... other config - environment: - DB_CONNECTION: mysql - DB_HOST: mysql - DB_DATABASE: authentikate - DB_USERNAME: authentikate - DB_PASSWORD: secure_password - depends_on: - - mysql - -volumes: - mysql_data: -``` - -## Reverse Proxy Setup - -### Traefik -AuthentiKate works perfectly with Traefik. Add these labels to your Docker Compose: - -```yaml -labels: - - "traefik.enable=true" - - "traefik.http.routers.authentikate.rule=Host(`auth.yourdomain.com`)" - - "traefik.http.routers.authentikate.entrypoints=websecure" - - "traefik.http.routers.authentikate.tls.certresolver=letsencrypt" - - "traefik.http.services.authentikate.loadbalancer.server.port=8080" -``` - -### Nginx -```nginx -server { - listen 443 ssl http2; - server_name auth.yourdomain.com; - - ssl_certificate /path/to/cert.pem; - ssl_certificate_key /path/to/key.pem; - - location / { - proxy_pass http://localhost:8080; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } -} -``` - -### Caddy -```caddyfile -auth.yourdomain.com { - reverse_proxy localhost:8080 -} -``` - -## First Run - -When you first start AuthentiKate, it will automatically: - -1. **Generate RSA Keys**: Creates public/private key pair for JWT signing -2. **Run Database Migrations**: Sets up all necessary database tables -3. **Create Admin User**: Generates an initial admin account - -The initial admin credentials will be displayed in the container logs: - -```bash -docker logs authentikate -``` - -Look for output like: -``` -✅ Initial admin user created: - Email: admin@authentikate.local - Password: randomly-generated-password -``` - -## Updating - -To update AuthentiKate: - -```bash -# Pull the latest image -docker pull authentikate/authentikate:latest - -# Stop and remove the old container -docker stop authentikate -docker rm authentikate - -# Start with the new image -docker-compose up -d -``` - -Your data will be preserved in the Docker volumes. - -## Backup - -### Database Backup (SQLite) -```bash -# Create backup -docker exec authentikate cp /var/www/html/storage/database/database.sqlite /tmp/backup.sqlite -docker cp authentikate:/tmp/backup.sqlite ./authentikate-backup-$(date +%Y%m%d).sqlite - -# Restore backup -docker cp ./authentikate-backup-20240101.sqlite authentikate:/tmp/restore.sqlite -docker exec authentikate cp /tmp/restore.sqlite /var/www/html/storage/database/database.sqlite -``` - -### Full Data Backup -```bash -# Backup all data -docker run --rm -v authentikate_data:/data -v $(pwd):/backup alpine tar czf /backup/authentikate-data-$(date +%Y%m%d).tar.gz -C /data . - -# Restore data -docker run --rm -v authentikate_data:/data -v $(pwd):/backup alpine tar xzf /backup/authentikate-data-20240101.tar.gz -C /data -``` - -## Next Steps - -Once AuthentiKate is running: - -1. [Complete the first setup →](/guide/first-setup) -2. [Configure your first application →](/guide/applications) -3. [Set up email notifications →](/config/email) \ No newline at end of file diff --git a/docs/guide/quick-start.md b/docs/guide/quick-start.md deleted file mode 100644 index 06e8ef8..0000000 --- a/docs/guide/quick-start.md +++ /dev/null @@ -1,159 +0,0 @@ -# Quick Start - -This guide will get you up and running with AuthentiKate in under 5 minutes. - -## Prerequisites - -- Docker installed on your system -- A domain name (optional, can use localhost for testing) - -## Step 1: Deploy AuthentiKate - -Run the following command to start AuthentiKate: - -```bash -docker run -d \ - --name authentikate \ - -p 8080:8080 \ - -e APP_URL=http://localhost:8080 \ - -v authentikate_data:/var/www/html/storage \ - authentikate/authentikate:latest -``` - -## Step 2: Get Your Admin Credentials - -AuthentiKate automatically creates an admin user on first run. Get the credentials from the logs: - -```bash -docker logs authentikate -``` - -Look for output like: -``` -✅ Initial admin user created: - Email: admin@authentikate.local - Password: Xy9#mK2$vB8nQ4!p -``` - -## Step 3: Access the Interface - -1. Open your browser and go to `http://localhost:8080` -2. Log in with the admin credentials from Step 2 -3. You'll be taken to the AuthentiKate dashboard - -## Step 4: Create Your First Application - -1. Click **"Applications"** in the navigation -2. Click **"Create Application"** -3. Fill in the details: - - **Name**: `Test App` - - **Redirect URI**: `http://localhost:3000/auth/callback` - - **Client ID**: (auto-generated) - - **Client Secret**: (auto-generated) - -4. Click **"Save"** - -## Step 5: Test the Integration - -Your application is now configured! Here are the OIDC endpoints you'll need: - -- **Authorization**: `http://localhost:8080/oauth/authorize` -- **Token**: `http://localhost:8080/oauth/token` -- **User Info**: `http://localhost:8080/oauth/userinfo` -- **JWKS**: `http://localhost:8080/.well-known/jwks.json` -- **Discovery**: `http://localhost:8080/.well-known/openid_configuration` - -## Common Integration Examples - -### Test with curl - -```bash -# Get authorization URL (replace CLIENT_ID with your actual client ID) -CLIENT_ID="your-client-id" -REDIRECT_URI="http://localhost:3000/auth/callback" - -echo "Visit this URL to authorize:" -echo "http://localhost:8080/oauth/authorize?client_id=${CLIENT_ID}&redirect_uri=${REDIRECT_URI}&response_type=code&scope=openid profile email" -``` - -### Simple HTML Test Page - -Create a simple test page to try the OAuth flow: - -```html - - -
-