fix(vikon): use correct token introspect endpoint for update system
Original vikon_core security.php validates tokens via: POST db-nica.ru/oauth2/resource/token/introspect Body: client_id=542&access_token=XXX Our code was incorrectly using: GET auth.db-nica.ru/api/profile_applicant/check_access_token Header: Authorization: Bearer XXX This was the WRONG endpoint — the profile check is for abitur forms, not for the update system.
This commit is contained in:
@@ -28,6 +28,7 @@ class VikonServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
$this->app->singleton(ValidateTokenTask::class, fn ($app) => new ValidateTokenTask(
|
$this->app->singleton(ValidateTokenTask::class, fn ($app) => new ValidateTokenTask(
|
||||||
http: $app->make(HttpTask::class),
|
http: $app->make(HttpTask::class),
|
||||||
|
clientId: config('vikon.client_id'),
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->app->singleton(RefreshTokenTask::class, fn ($app) => new RefreshTokenTask(
|
$this->app->singleton(RefreshTokenTask::class, fn ($app) => new RefreshTokenTask(
|
||||||
|
|||||||
@@ -8,16 +8,17 @@ class ValidateTokenTask
|
|||||||
{
|
{
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private readonly HttpTask $http,
|
private readonly HttpTask $http,
|
||||||
|
private readonly string $clientId,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function run(string $accessToken): bool
|
public function run(string $accessToken): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$response = $this->http->getWithToken(
|
$response = $this->http->post('oauth2/resource/token/introspect', [
|
||||||
'api/profile_applicant/check_access_token',
|
'client_id' => $this->clientId,
|
||||||
$accessToken,
|
'access_token' => $accessToken,
|
||||||
'auth'
|
]);
|
||||||
);
|
|
||||||
return $response->successful();
|
return $response->successful();
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
Log::warning('Vikon token validation failed', ['error' => $e->getMessage()]);
|
Log::warning('Vikon token validation failed', ['error' => $e->getMessage()]);
|
||||||
|
|||||||
Reference in New Issue
Block a user