mirror of
https://github.com/btouchard/ackify.git
synced 2026-02-06 05:49:38 -06:00
- Implement PKCE (Proof Key for Code Exchange) with S256 method - Add crypto/pkce module with code verifier and challenge generation - Modify OAuth flow to include code_challenge in authorization requests - Update HandleCallback to validate code_verifier during token exchange - Extend session lifetime from 7 to 30 days - Add comprehensive unit tests for PKCE functions - Maintain backward compatibility with fallback for non-PKCE sessions - Add detailed logging for OAuth flow with PKCE tracking PKCE enhances security by preventing authorization code interception attacks, as recommended by OAuth 2.1 and OIDC standards. feat: add encrypted refresh token storage with automatic cleanup - Add oauth_sessions table for storing encrypted refresh tokens - Implement AES-256-GCM encryption for refresh tokens using cookie secret - Create OAuth session repository with full CRUD operations - Add SessionWorker for automatic cleanup of expired sessions - Configure cleanup to run every 24h for sessions older than 37 days - Modify OAuth flow to store refresh tokens after successful authentication - Track client IP and user agent for session security validation - Link OAuth sessions to user sessions via session ID - Add comprehensive encryption tests with security validations - Integrate SessionWorker into server lifecycle with graceful shutdown This enables persistent OAuth sessions with secure token storage, reducing the need for frequent re-authentication from 7 to 30 days.
4.7 KiB
4.7 KiB
Getting Started
Guide d'installation et de configuration d'Ackify avec Docker Compose.
Prérequis
- Docker et Docker Compose installés
- Un domaine (ou localhost pour les tests)
- Credentials OAuth2 (Google, GitHub, GitLab, ou custom)
Installation Rapide
1. Cloner le dépôt
git clone https://github.com/btouchard/ackify-ce.git
cd ackify-ce
2. Configuration
Copier le fichier d'exemple et l'éditer :
cp .env.example .env
nano .env
Variables obligatoires minimales :
# Domaine public de votre instance
APP_DNS=sign.your-domain.com
ACKIFY_BASE_URL=https://sign.your-domain.com
ACKIFY_ORGANISATION="Your Organization Name"
# Base de données PostgreSQL
POSTGRES_USER=ackifyr
POSTGRES_PASSWORD=your_secure_password_here
POSTGRES_DB=ackify
# OAuth2 (exemple avec Google)
ACKIFY_OAUTH_PROVIDER=google
ACKIFY_OAUTH_CLIENT_ID=your_google_client_id
ACKIFY_OAUTH_CLIENT_SECRET=your_google_client_secret
# Sécurité - générer avec: openssl rand -base64 32
ACKIFY_OAUTH_COOKIE_SECRET=your_base64_encoded_secret_key
3. Démarrage
docker compose up -d
Cette commande va :
- Télécharger les images Docker nécessaires
- Démarrer PostgreSQL avec healthcheck
- Appliquer les migrations de base de données
- Lancer l'application Ackify
4. Vérification
# Voir les logs
docker compose logs -f ackify-ce
# Vérifier le health check
curl http://localhost:8080/api/v1/health
# Attendu: {"status":"healthy","database":"connected"}
5. Accès à l'interface
Ouvrir votre navigateur :
- Interface publique : http://localhost:8080
- Admin dashboard : http://localhost:8080/admin (nécessite email dans ACKIFY_ADMIN_EMAILS)
Configuration OAuth2
Avant de pouvoir utiliser Ackify, configurez votre provider OAuth2.
Google OAuth2
- Aller sur Google Cloud Console
- Créer un nouveau projet ou sélectionner un projet existant
- Activer l'API "Google+ API"
- Créer des credentials OAuth 2.0 :
- Type : Web application
- Authorized redirect URIs :
https://sign.your-domain.com/api/v1/auth/callback
- Copier le Client ID et Client Secret dans
.env
ACKIFY_OAUTH_PROVIDER=google
ACKIFY_OAUTH_CLIENT_ID=123456789-abc.apps.googleusercontent.com
ACKIFY_OAUTH_CLIENT_SECRET=GOCSPX-xyz...
GitHub OAuth2
- Aller sur GitHub Developer Settings
- Créer une nouvelle OAuth App
- Configuration :
- Homepage URL :
https://sign.your-domain.com - Callback URL :
https://sign.your-domain.com/api/v1/auth/callback
- Homepage URL :
- Générer un client secret
ACKIFY_OAUTH_PROVIDER=github
ACKIFY_OAUTH_CLIENT_ID=Iv1.abc123
ACKIFY_OAUTH_CLIENT_SECRET=ghp_xyz...
Voir OAuth Providers pour GitLab et custom providers.
Génération des Secrets
# Cookie secret (obligatoire)
openssl rand -base64 32
# Ed25519 private key (optionnel, auto-généré si absent)
openssl rand -base64 64
Premiers Pas
Créer votre première signature
- Accéder à
http://localhost:8080/?doc=test_document - Cliquer sur "Sign this document"
- Se connecter via OAuth2
- Valider la signature
Accéder au dashboard admin
- Ajouter votre email dans
.env:ACKIFY_ADMIN_EMAILS=admin@company.com - Redémarrer :
docker compose restart ackify-ce - Se connecter puis accéder à
/admin
Intégrer dans une page
<!-- Widget embeddable -->
<iframe src="https://sign.your-domain.com/?doc=test_document"
width="600" height="200"
frameborder="0"
style="border: 1px solid #ddd; border-radius: 6px;"></iframe>
Commandes Utiles
# Voir les logs
docker compose logs -f ackify-ce
# Redémarrer
docker compose restart ackify-ce
# Arrêter
docker compose down
# Reconstruire après modifications
docker compose up -d --force-recreate ackify-ce --build
# Accéder à la base de données
docker compose exec ackify-db psql -U ackifyr -d ackify
Troubleshooting
L'application ne démarre pas
# Vérifier les logs
docker compose logs ackify-ce
# Vérifier la santé de PostgreSQL
docker compose ps ackify-db
Erreur de migration
# Relancer les migrations manuellement
docker compose up ackify-migrate
OAuth callback error
Vérifier que :
ACKIFY_BASE_URLcorrespond exactement à votre domaine- La callback URL dans le provider OAuth2 est correcte
- Le cookie secret est bien configuré