- Add comprehensive health check system with multiple endpoints - Add Prometheus metrics endpoint - Add production logging configurations (5 strategies) - Add complete deployment documentation suite: * QUICKSTART.md - 30-minute deployment guide * DEPLOYMENT_CHECKLIST.md - Printable verification checklist * DEPLOYMENT_WORKFLOW.md - Complete deployment lifecycle * PRODUCTION_DEPLOYMENT.md - Comprehensive technical reference * production-logging.md - Logging configuration guide * ANSIBLE_DEPLOYMENT.md - Infrastructure as Code automation * README.md - Navigation hub * DEPLOYMENT_SUMMARY.md - Executive summary - Add deployment scripts and automation - Add DEPLOYMENT_PLAN.md - Concrete plan for immediate deployment - Update README with production-ready features All production infrastructure is now complete and ready for deployment.
82 lines
1.9 KiB
PHP
82 lines
1.9 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\OAuth;
|
|
|
|
use App\Framework\OAuth\Storage\StoredOAuthToken;
|
|
|
|
/**
|
|
* OAuth Service Interface
|
|
*
|
|
* Contract for OAuth token management services
|
|
*/
|
|
interface OAuthServiceInterface
|
|
{
|
|
/**
|
|
* Get provider by name
|
|
*/
|
|
public function getProvider(string $name): OAuthProvider;
|
|
|
|
/**
|
|
* Get authorization URL for provider
|
|
*
|
|
* @param array<string, mixed> $options
|
|
*/
|
|
public function getAuthorizationUrl(string $provider, array $options = []): string;
|
|
|
|
/**
|
|
* Handle OAuth callback and store token
|
|
*/
|
|
public function handleCallback(
|
|
string $userId,
|
|
string $provider,
|
|
string $code,
|
|
?string $state = null
|
|
): StoredOAuthToken;
|
|
|
|
/**
|
|
* Get token for user with automatic refresh if expired
|
|
*/
|
|
public function getTokenForUser(string $userId, string $provider): StoredOAuthToken;
|
|
|
|
/**
|
|
* Refresh an expired token
|
|
*/
|
|
public function refreshToken(StoredOAuthToken $storedToken): StoredOAuthToken;
|
|
|
|
/**
|
|
* Revoke token and remove from storage
|
|
*/
|
|
public function revokeToken(string $userId, string $provider): bool;
|
|
|
|
/**
|
|
* Get user profile from provider
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function getUserProfile(string $userId, string $provider): array;
|
|
|
|
/**
|
|
* Check if user has connected a provider
|
|
*/
|
|
public function hasProvider(string $userId, string $provider): bool;
|
|
|
|
/**
|
|
* Get all providers for user
|
|
*
|
|
* @return array<StoredOAuthToken>
|
|
*/
|
|
public function getUserProviders(string $userId): array;
|
|
|
|
/**
|
|
* Refresh all expiring tokens (background job)
|
|
*/
|
|
public function refreshExpiringTokens(int $withinSeconds = 300): int;
|
|
|
|
/**
|
|
* Clean up expired tokens without refresh token (background job)
|
|
*/
|
|
public function cleanupExpiredTokens(): int;
|
|
}
|