- Go 68.6%
- Shell 14.5%
- Makefile 12.2%
- Dockerfile 4.7%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .cursor/rules | ||
| cmd/api | ||
| docs | ||
| internal | ||
| pkg/logger | ||
| .gitignore | ||
| .golangci.yml | ||
| docker-compose.yml | ||
| Dockerfile | ||
| ess.md | ||
| execution_plan.md | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| PRD.md | ||
| progress.md | ||
| README.md | ||
| services.md | ||
| startup.sh | ||
Identity & Security API
Overview
The Identity & Security API is the central security authority for the Executive Scheduling System (ESS), providing enterprise-grade authentication, authorization, user management, and security compliance for high-level executive environments.
Mission
Deliver a zero-trust security service that protects sensitive executive scheduling data while enabling seamless, secure access across all system components and external integrations.
Key Features
- Multi-Factor Authentication with biometric support (WebAuthn/FIDO2)
- Single Sign-On (SSO) with SAML 2.0 and OpenID Connect
- Role-Based Access Control (RBAC) with hierarchical inheritance
- Attribute-Based Access Control (ABAC) for complex scenarios
- Enterprise Directory Integration (Active Directory, LDAP)
- Advanced Threat Detection with machine learning
- Comprehensive Audit Logging with tamper-evident storage
- Compliance Management (SOC 2, GDPR, ISO 27001)
- Passwordless Authentication options
- Privileged Access Management integration
Architecture
Technology Stack
- Backend: Go 1.24+
- Database: PostgreSQL 15+ with encryption at rest
- Cache: Redis 7+ with encryption
- Message Queue: NATS or Go channels
- Container Platform: Docker with security scanning
- Orchestration: Kubernetes with security policies
- Service Mesh: Istio or Linkerd for secure communication
Security-First Design
- Zero Trust Architecture: Never trust, always verify
- End-to-End Encryption: TLS 1.3 in transit, AES-256 at rest
- Hardware Security Modules (HSM) for key management
- Immutable Audit Logs with cryptographic signatures
- Network Segmentation and micro-segmentation
Prerequisites
Development Environment
- Go 1.24 or later
- Docker and Docker Compose
- Kubernetes cluster (for production deployment)
- PostgreSQL 15+
- Redis 7+
- Git with GPG signing configured
Security Tools
- HashiCorp Vault (secret management)
- SonarQube (code quality analysis)
- Trivy (vulnerability scanning)
- OWASP ZAP (security testing)
Required Knowledge
- Go programming and best practices
- PostgreSQL database design and optimization
- Kubernetes and container orchestration
- Security principles and cryptography
- OAuth 2.1, SAML 2.0, OpenID Connect
- GDPR and SOC 2 compliance requirements
Quick Start
1. Clone and Setup
git clone <repository-url>
cd auth_id
cp .env.example .env
2. Environment Configuration
# Edit .env with your configuration
export DATABASE_URL="postgresql://user:password@localhost/auth_api"
export REDIS_URL="redis://localhost:6379"
export VAULT_ADDR="https://vault.example.com"
export JWT_SECRET="your-jwt-secret"
3. Database Setup
# Start PostgreSQL and Redis
docker-compose up -d postgres redis
# Run database migrations
go run cmd/migrate/main.go up
4. Development Server
# Install dependencies
go mod download
# Run development server
go run cmd/server/main.go
5. Verify Installation
# Health check
curl http://localhost:8080/health
# API documentation
open http://localhost:8080/swagger/
Development Guidelines
Code Standards
- Follow Go best practices and idioms
- Use
gofmt,golint, andgo vet - Maintain test coverage >80%
- Security-first development approach
- Document all public APIs
Security Requirements
- Never log sensitive data (passwords, tokens, PII)
- Validate all inputs and sanitize outputs
- Use parameterized queries to prevent SQL injection
- Implement rate limiting on all endpoints
- Follow OWASP security guidelines
Git Workflow
- Use feature branches for development
- Require GPG-signed commits
- Mandatory code review for all changes
- Security review for authentication/authorization changes
- Automated security scanning in CI/CD
Testing Strategy
# Unit tests
go test ./...
# Integration tests
go test -tags=integration ./...
# Security tests
go test -tags=security ./...
# Load tests
go test -tags=load ./...
API Documentation
Core Endpoints
Authentication
POST /auth/register- User registrationPOST /auth/login- User authenticationPOST /auth/logout- Secure session terminationPOST /auth/refresh- Token refreshPOST /auth/mfa/enroll- MFA enrollmentPOST /auth/mfa/verify- MFA verification
Authorization
POST /authz/check- Permission validationGET /authz/roles- List user rolesPOST /authz/policies- Create authorization policyPOST /authz/delegate- Create delegation
User Management
GET /users/{id}- Get user profilePUT /users/{id}- Update user profilePOST /users/{id}/roles- Assign roleGET /users/{id}/permissions- List permissions
Security Monitoring
GET /security/events- Security eventsGET /security/threats- Threat detectionPOST /security/incidents- Report incident
Audit & Compliance
GET /audit/logs- Retrieve audit logsGET /compliance/status- Compliance statusPOST /compliance/assess- Run assessment
Response Format
{
"success": true,
"data": {},
"message": "Operation successful",
"timestamp": "2024-01-01T00:00:00Z",
"request_id": "uuid"
}
Error Handling
{
"success": false,
"error": {
"code": "AUTH_FAILED",
"message": "Authentication failed",
"details": {}
},
"timestamp": "2024-01-01T00:00:00Z",
"request_id": "uuid"
}
Security Considerations
Authentication Security
- Passwords hashed with Argon2id
- Session tokens cryptographically secure
- Account lockout after failed attempts
- Rate limiting on authentication endpoints
- Audit logging for all authentication events
Data Protection
- Field-level encryption for sensitive data
- TLS 1.3 for all communications
- Key rotation automated
- Data anonymization for analytics
- GDPR compliance for data handling
Network Security
- VPN-only access for administrative functions
- IP whitelisting for critical operations
- Network segmentation between services
- DDoS protection and rate limiting
- WAF protection for web endpoints
Monitoring and Alerting
- Real-time security event monitoring
- Behavioral anomaly detection
- Failed authentication tracking
- Suspicious activity alerts
- Incident response automation
Deployment
Local Development
docker-compose up -d
go run cmd/server/main.go
Staging Environment
kubectl apply -f deployments/staging/
helm install auth-api ./charts/auth-api -f values-staging.yaml
Production Deployment
# Blue-green deployment
kubectl apply -f deployments/production/
helm upgrade auth-api ./charts/auth-api -f values-production.yaml
Environment Variables
| Variable | Description | Required | Default |
|---|---|---|---|
DATABASE_URL |
PostgreSQL connection string | Yes | - |
REDIS_URL |
Redis connection string | Yes | - |
JWT_SECRET |
JWT signing secret | Yes | - |
VAULT_ADDR |
HashiCorp Vault address | Yes | - |
LOG_LEVEL |
Logging level | No | info |
PORT |
Server port | No | 8080 |
Monitoring and Observability
Metrics
- Authentication success/failure rates
- API response times and throughput
- Database connection pool usage
- Cache hit rates
- Security event counts
Logging
- Structured JSON logging
- Correlation IDs for request tracing
- Security event logging
- Performance metrics logging
- Error tracking and alerting
Health Checks
GET /health- Basic health checkGET /health/ready- Readiness probeGET /health/live- Liveness probeGET /metrics- Prometheus metrics
Contributing
Getting Started
- Read this README thoroughly
- Review the PRD.md and execution_plan.md
- Set up your development environment
- Read the security guidelines below
- Submit your first pull request
Pull Request Process
- Create feature branch from
main - Implement changes with tests
- Run security and quality checks
- Submit PR with detailed description
- Address review feedback
- Merge after approval
Code Review Checklist
- Security review completed
- Tests added/updated
- Documentation updated
- Performance impact assessed
- Breaking changes documented
- Compliance requirements met
Commit Message Format
type(scope): brief description
Detailed description if needed
Fixes #issue-number
Types: feat, fix, docs, style, refactor, test, chore, security
Security Reporting
Responsible Disclosure
We take security seriously. If you discover a security vulnerability, please follow responsible disclosure:
- DO NOT open a public issue
- Email security team:
security@company.com - Include detailed description and reproduction steps
- Allow 90 days for investigation and fix
- Coordinate public disclosure timing
Security Contacts
- Security Team: security@company.com
- Emergency Contact: security-emergency@company.com
- PGP Key: Available at security@company.com
Compliance and Auditing
Compliance Standards
- SOC 2 Type II certification
- GDPR compliance for EU operations
- ISO 27001 security management
- NIST Cybersecurity Framework alignment
- Government security clearance compatibility
Audit Trails
- All user actions logged immutably
- Security events tracked and analyzed
- Compliance reports generated automatically
- Forensic investigation support
- Long-term audit data retention
Performance Targets
- API Response Time: <100ms (95th percentile)
- Authentication Time: <100ms
- System Availability: 99.9%
- Concurrent Users: 10,000+
- Database Performance: <50ms query time
Support and Documentation
Documentation
Getting Help
- Technical Issues: Create GitHub issue
- Security Questions: security@company.com
- General Questions: team@company.com
Community
- Slack: #auth-api-dev
- Wiki: Internal wiki for detailed documentation
- Team Meetings: Weekly security review meetings
License
This project is proprietary and confidential. Unauthorized access, use, or distribution is strictly prohibited.
© 2024 Executive Scheduling System. All rights reserved.
Quick Reference
Development Commands
# Build
go build ./cmd/server
# Test
go test ./...
# Security scan
gosec ./...
# Generate docs
swag init -g cmd/server/main.go
# Database migration
go run cmd/migrate/main.go up
# Load test
go test -tags=load ./tests/load/
Emergency Procedures
- Security Incident: Follow incident response playbook
- System Outage: Check health endpoints and logs
- Data Breach: Immediately contact security team
- Compliance Issue: Notify compliance officer
Key Contacts
- Tech Lead: tech-lead@company.com
- Security Officer: security@company.com
- Compliance Officer: compliance@company.com
- On-Call Engineer: on-call@company.com