Files
breadcrumb-the-shire/modules/helpdesk/lib/Module/Helpdesk/Service/HelpdeskOAuthTokenService.php
fs a0d7670dd7 feat(helpdesk): align module with core list/drawer standards
- add helpdesk module pages, services, settings and tests

- standardize debtor list on drawer/grid contracts and robust filter drawer behavior

- add helpdesk aside panel navigation and settings visibility provider

- switch primary list slug to helpdesk/debitor and remove helpdesk/search compatibility

- include required core contract updates for list contracts and detail/drawer integration
2026-04-02 17:48:27 +02:00

42 lines
1.2 KiB
PHP

<?php
namespace MintyPHP\Module\Helpdesk\Service;
/**
* OAuth2 client_credentials token service for BC OData access.
*
* This is a skeleton for V1. Basic Auth is the default and recommended
* auth mode. OAuth2 support can be activated in settings but the full
* token flow (request, cache, refresh) is deferred to a future version.
*/
class HelpdeskOAuthTokenService
{
public function __construct(
private readonly HelpdeskSettingsGateway $settingsGateway,
private readonly HelpdeskTokenRepository $tokenRepository
) {
}
/**
* Get a valid access token for BC API calls.
*
* @return string|null The bearer token, or null if unavailable.
*/
public function getAccessToken(int $tenantId): ?string
{
if ($this->settingsGateway->getAuthMode() !== HelpdeskSettingsGateway::AUTH_MODE_OAUTH2) {
return null;
}
// Check cache first
$cached = $this->tokenRepository->findValidToken($tenantId);
if ($cached !== null) {
return $cached;
}
// Token request would go here in a future version.
// For V1, return null to indicate OAuth2 is not yet fully implemented.
return null;
}
}