Authentik Identity Provider
Authentik open-source identity provider with SSO, MFA, and user management.
Overview
Authentik is a modern, open-source identity provider that consolidates authentication, authorization, and user management into a single platform. Born from the need for a more flexible alternative to traditional identity solutions, Authentik supports multiple authentication protocols including OIDC, OAuth2, SAML, and LDAP, while providing advanced features like flow-based authentication, WebAuthn support, and application proxying. Its architecture emphasizes customization and developer-friendly configuration over rigid enterprise constraints.
This stack combines Authentik's server and worker components with PostgreSQL for robust data persistence and Redis for session management and caching. The server component handles web requests, user authentication flows, and the administration interface, while the worker processes background tasks like user provisioning, email notifications, and SCIM synchronization. PostgreSQL stores user data, application configurations, and audit logs with full ACID compliance, while Redis manages active sessions, caches frequently accessed data, and handles real-time features like WebSocket connections for the admin interface.
This configuration targets organizations seeking comprehensive identity management without vendor lock-in or enterprise licensing costs. Development teams building multiple applications benefit from centralized SSO, while system administrators gain detailed user lifecycle management and compliance reporting. The stack particularly excels in environments requiring custom authentication flows, such as multi-tenant SaaS applications, developer platforms with complex permission models, or organizations integrating legacy systems with modern OAuth-based applications.
Key Features
- Multi-protocol authentication support including OIDC, OAuth2, SAML 2.0, and LDAP outbound authentication
- Flow-based authentication system allowing custom multi-step verification processes and conditional logic
- Built-in application proxy with automatic header injection for applications lacking native SSO support
- WebAuthn and TOTP multi-factor authentication with conditional MFA based on user context
- SCIM 2.0 provisioning for automated user lifecycle management across connected applications
- Customizable branding and theming with support for per-application visual identity
- Advanced user and group management with hierarchical permissions and custom attributes
- Comprehensive audit logging with detailed authentication events and administrative actions
Common Use Cases
- 1Centralizing authentication for multiple internal applications and services in development teams
- 2Implementing SSO for legacy applications that lack modern authentication through the application proxy
- 3Building multi-tenant SaaS platforms requiring customer-specific authentication flows and branding
- 4Securing homelab environments with professional-grade authentication and MFA capabilities
- 5Replacing expensive enterprise identity solutions while maintaining compliance and audit requirements
- 6Integrating disparate systems through standardized OIDC/SAML protocols with custom attribute mapping
- 7Providing self-service user management portals for organizations with distributed administration needs
Prerequisites
- Minimum 1.5GB RAM available (512MB for Authentik server, 256MB for PostgreSQL, 128MB for Redis, plus worker overhead)
- Ports 9000 and 9443 available for HTTP and HTTPS access to the Authentik interface
- Domain name or static IP address for consistent callback URL configuration in OAuth applications
- Understanding of OAuth2/OIDC concepts including client credentials, scopes, and redirect URIs
- Docker socket access if using Authentik's Docker integration features for automatic service discovery
- Valid SSL certificates if exposing Authentik publicly for production SSO implementations
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 authentik-server: 3 image: ghcr.io/goauthentik/server:2024.14 container_name: authentik-server5 command: server6 environment: 7 - AUTHENTIK_REDIS__HOST=redis8 - AUTHENTIK_POSTGRESQL__HOST=postgres9 - AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}10 - AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD}11 - AUTHENTIK_POSTGRESQL__NAME=authentik12 - AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY}13 volumes: 14 - authentik_media:/media15 - authentik_templates:/templates16 ports: 17 - "9000:9000"18 - "9443:9443"19 depends_on: 20 postgres: 21 condition: service_healthy22 redis: 23 condition: service_healthy24 networks: 25 - authentik-network2627 authentik-worker: 28 image: ghcr.io/goauthentik/server:2024.129 container_name: authentik-worker30 command: worker31 environment: 32 - AUTHENTIK_REDIS__HOST=redis33 - AUTHENTIK_POSTGRESQL__HOST=postgres34 - AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}35 - AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD}36 - AUTHENTIK_POSTGRESQL__NAME=authentik37 - AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY}38 volumes: 39 - authentik_media:/media40 - authentik_templates:/templates41 - /var/run/docker.sock:/var/run/docker.sock42 depends_on: 43 postgres: 44 condition: service_healthy45 redis: 46 condition: service_healthy47 networks: 48 - authentik-network4950 postgres: 51 image: postgres:16-alpine52 container_name: authentik-db53 environment: 54 - POSTGRES_USER=${POSTGRES_USER}55 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}56 - POSTGRES_DB=authentik57 volumes: 58 - postgres_data:/var/lib/postgresql/data59 healthcheck: 60 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]61 interval: 10s62 timeout: 5s63 retries: 564 networks: 65 - authentik-network6667 redis: 68 image: redis:7-alpine69 container_name: authentik-redis70 command: --save 60 1 --loglevel warning71 volumes: 72 - redis_data:/data73 healthcheck: 74 test: ["CMD", "redis-cli", "ping"]75 interval: 10s76 timeout: 5s77 retries: 578 networks: 79 - authentik-network8081volumes: 82 authentik_media: 83 authentik_templates: 84 postgres_data: 85 redis_data: 8687networks: 88 authentik-network: 89 driver: bridge.env Template
.env
1# Authentik2POSTGRES_USER=authentik3POSTGRES_PASSWORD=authentik_password4AUTHENTIK_SECRET_KEY=your-secret-key-at-least-50-charsUsage Notes
- 1Admin interface at http://localhost:9000/if/flow/initial-setup/
- 2Set up initial admin user on first visit
- 3Supports OIDC, OAuth2, SAML, LDAP
- 4Built-in MFA support
- 5Application proxy for SSO
Individual Services(4 services)
Copy individual services to mix and match with your existing compose files.
authentik-server
authentik-server:
image: ghcr.io/goauthentik/server:2024.1
container_name: authentik-server
command: server
environment:
- AUTHENTIK_REDIS__HOST=redis
- AUTHENTIK_POSTGRESQL__HOST=postgres
- AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}
- AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD}
- AUTHENTIK_POSTGRESQL__NAME=authentik
- AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY}
volumes:
- authentik_media:/media
- authentik_templates:/templates
ports:
- "9000:9000"
- "9443:9443"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik-network
authentik-worker
authentik-worker:
image: ghcr.io/goauthentik/server:2024.1
container_name: authentik-worker
command: worker
environment:
- AUTHENTIK_REDIS__HOST=redis
- AUTHENTIK_POSTGRESQL__HOST=postgres
- AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}
- AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD}
- AUTHENTIK_POSTGRESQL__NAME=authentik
- AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY}
volumes:
- authentik_media:/media
- authentik_templates:/templates
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
networks:
- authentik-network
postgres
postgres:
image: postgres:16-alpine
container_name: authentik-db
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=authentik
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test:
- CMD-SHELL
- pg_isready -U ${POSTGRES_USER}
interval: 10s
timeout: 5s
retries: 5
networks:
- authentik-network
redis
redis:
image: redis:7-alpine
container_name: authentik-redis
command: "--save 60 1 --loglevel warning"
volumes:
- redis_data:/data
healthcheck:
test:
- CMD
- redis-cli
- ping
interval: 10s
timeout: 5s
retries: 5
networks:
- authentik-network
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 authentik-server:5 image: ghcr.io/goauthentik/server:2024.16 container_name: authentik-server7 command: server8 environment:9 - AUTHENTIK_REDIS__HOST=redis10 - AUTHENTIK_POSTGRESQL__HOST=postgres11 - AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}12 - AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD}13 - AUTHENTIK_POSTGRESQL__NAME=authentik14 - AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY}15 volumes:16 - authentik_media:/media17 - authentik_templates:/templates18 ports:19 - "9000:9000"20 - "9443:9443"21 depends_on:22 postgres:23 condition: service_healthy24 redis:25 condition: service_healthy26 networks:27 - authentik-network2829 authentik-worker:30 image: ghcr.io/goauthentik/server:2024.131 container_name: authentik-worker32 command: worker33 environment:34 - AUTHENTIK_REDIS__HOST=redis35 - AUTHENTIK_POSTGRESQL__HOST=postgres36 - AUTHENTIK_POSTGRESQL__USER=${POSTGRES_USER}37 - AUTHENTIK_POSTGRESQL__PASSWORD=${POSTGRES_PASSWORD}38 - AUTHENTIK_POSTGRESQL__NAME=authentik39 - AUTHENTIK_SECRET_KEY=${AUTHENTIK_SECRET_KEY}40 volumes:41 - authentik_media:/media42 - authentik_templates:/templates43 - /var/run/docker.sock:/var/run/docker.sock44 depends_on:45 postgres:46 condition: service_healthy47 redis:48 condition: service_healthy49 networks:50 - authentik-network5152 postgres:53 image: postgres:16-alpine54 container_name: authentik-db55 environment:56 - POSTGRES_USER=${POSTGRES_USER}57 - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}58 - POSTGRES_DB=authentik59 volumes:60 - postgres_data:/var/lib/postgresql/data61 healthcheck:62 test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]63 interval: 10s64 timeout: 5s65 retries: 566 networks:67 - authentik-network6869 redis:70 image: redis:7-alpine71 container_name: authentik-redis72 command: --save 60 1 --loglevel warning73 volumes:74 - redis_data:/data75 healthcheck:76 test: ["CMD", "redis-cli", "ping"]77 interval: 10s78 timeout: 5s79 retries: 580 networks:81 - authentik-network8283volumes:84 authentik_media:85 authentik_templates:86 postgres_data:87 redis_data:8889networks:90 authentik-network:91 driver: bridge92EOF9394# 2. Create the .env file95cat > .env << 'EOF'96# Authentik97POSTGRES_USER=authentik98POSTGRES_PASSWORD=authentik_password99AUTHENTIK_SECRET_KEY=your-secret-key-at-least-50-chars100EOF101102# 3. Start the services103docker compose up -d104105# 4. View logs106docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/authentik-identity/run | bashTroubleshooting
- Authentik server fails to start with 'database connection failed': Ensure PostgreSQL container is fully initialized before Authentik starts, check database credentials in environment variables
- OAuth applications show 'invalid_client' errors: Verify the client ID and secret match exactly in both Authentik provider configuration and the consuming application
- Users cannot complete authentication flows: Check Redis connectivity as session data may be lost, restart Redis container and clear browser cookies
- SAML assertions fail validation: Ensure clock synchronization between Authentik and service provider, check certificate validity and metadata exchange
- Background tasks not processing (password resets, emails): Authentik worker container may be failing, check worker logs for Celery connection issues to Redis
- Performance degradation with many users: Increase PostgreSQL shared_buffers and Redis maxmemory settings, consider connection pooling for high-traffic scenarios
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Components
authentik-serverauthentik-workerpostgresredis
Tags
#authentik#sso#identity#oauth#saml#ldap
Category
Security & NetworkingAd Space
Shortcuts: C CopyF FavoriteD Download