mirror of
https://github.com/wahyd4/passkey-auth.git
synced 2026-08-09 04:15:55 +10:00
feat: initial commit - WebAuthn passkey authentication service
- Complete WebAuthn/FIDO2 authentication implementation - SQLite database with user and credential management - Email-based user identification with allowlist support - Admin approval workflow for new users - Session management with secure cookies - Docker containerization with Debian base for SQLite compatibility - Kubernetes deployment manifests with nginx ingress support - Web-based admin interface for user management - Comprehensive documentation and deployment guides - Standard open source project structure with CI/CD
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Building Passkey Auth..."
|
||||
|
||||
# Build Docker image
|
||||
echo "Building Docker image..."
|
||||
docker build -t passkey-auth:latest .
|
||||
|
||||
echo "✅ Build complete!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Update k8s/deployment.yaml with your domain and session secret"
|
||||
echo "2. Run ./scripts/deploy.sh to deploy to Kubernetes"
|
||||
echo "3. Configure your nginx ingress to use passkey auth"
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Deploying Passkey Auth to Kubernetes..."
|
||||
|
||||
# Check if kubectl is available
|
||||
if ! command -v kubectl &> /dev/null; then
|
||||
echo "❌ kubectl is not installed or not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create namespace
|
||||
echo "Creating namespace..."
|
||||
kubectl apply -f k8s/namespace.yaml
|
||||
|
||||
# Deploy the application
|
||||
echo "Deploying application..."
|
||||
kubectl apply -f k8s/deployment.yaml
|
||||
|
||||
# Wait for deployment to be ready
|
||||
echo "Waiting for deployment to be ready..."
|
||||
kubectl wait --for=condition=available --timeout=300s deployment/passkey-auth -n passkey-auth
|
||||
|
||||
echo "✅ Deployment complete!"
|
||||
echo ""
|
||||
echo "To check the status:"
|
||||
echo " kubectl get pods -n passkey-auth"
|
||||
echo ""
|
||||
echo "To view logs:"
|
||||
echo " kubectl logs -f deployment/passkey-auth -n passkey-auth"
|
||||
echo ""
|
||||
echo "To configure nginx ingress, see k8s/ingress-example.yaml"
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🔧 Starting Passkey Auth in development mode..."
|
||||
|
||||
# Check if Go is installed
|
||||
if ! command -v go &> /dev/null; then
|
||||
echo "❌ Go is not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Install dependencies
|
||||
echo "Installing dependencies..."
|
||||
go mod download
|
||||
|
||||
# Set development environment variables
|
||||
export PORT=8080
|
||||
export WEBAUTHN_RP_ID=localhost
|
||||
export DATABASE_PATH=./dev-passkey-auth.db
|
||||
export SESSION_SECRET=dev-secret-not-for-production
|
||||
|
||||
echo "🚀 Starting server..."
|
||||
echo "Access the admin interface at: http://localhost:8080"
|
||||
echo "Press Ctrl+C to stop"
|
||||
|
||||
# Run the application
|
||||
go run main.go
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧪 Testing Passkey Auth Build..."
|
||||
|
||||
# Clean previous builds
|
||||
rm -f bin/passkey-auth
|
||||
|
||||
# Test build
|
||||
echo "Building application..."
|
||||
go build -o bin/passkey-auth .
|
||||
|
||||
if [ -f "bin/passkey-auth" ]; then
|
||||
echo "✅ Build successful!"
|
||||
echo "📦 Binary size: $(du -h bin/passkey-auth | cut -f1)"
|
||||
else
|
||||
echo "❌ Build failed!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test basic functionality
|
||||
echo ""
|
||||
echo "🔍 Testing basic configuration..."
|
||||
|
||||
# Create test config
|
||||
cat > test-config.yaml << EOF
|
||||
server:
|
||||
port: "8080"
|
||||
host: "localhost"
|
||||
|
||||
webauthn:
|
||||
rp_display_name: "Test Auth"
|
||||
rp_id: "localhost"
|
||||
rp_origins:
|
||||
- "http://localhost:8080"
|
||||
|
||||
database:
|
||||
path: "test.db"
|
||||
|
||||
cors:
|
||||
allowed_origins:
|
||||
- "*"
|
||||
|
||||
auth:
|
||||
session_secret: "test-secret"
|
||||
require_approval: false
|
||||
allowed_emails:
|
||||
- "test@example.com"
|
||||
- "admin@example.com"
|
||||
EOF
|
||||
|
||||
echo "✅ Test configuration created"
|
||||
|
||||
# Clean up
|
||||
rm -f test-config.yaml test.db
|
||||
|
||||
echo ""
|
||||
echo "🎉 All tests passed!"
|
||||
echo ""
|
||||
echo "To run the application:"
|
||||
echo " ./bin/passkey-auth"
|
||||
echo ""
|
||||
echo "To run in development mode:"
|
||||
echo " ./scripts/dev.sh"
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "🧹 Undeploying Passkey Auth from Kubernetes..."
|
||||
|
||||
# Delete the application
|
||||
echo "Deleting application..."
|
||||
kubectl delete -f k8s/deployment.yaml --ignore-not-found=true
|
||||
|
||||
# Delete namespace (this will also delete PVC - data will be lost!)
|
||||
read -p "⚠️ This will delete all data. Are you sure? (y/N): " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
kubectl delete -f k8s/namespace.yaml --ignore-not-found=true
|
||||
echo "✅ Undeployment complete!"
|
||||
else
|
||||
echo "❌ Cancelled"
|
||||
fi
|
||||
Reference in New Issue
Block a user