Fix login authentication using security key
This commit is contained in:
parent
09497c234a
commit
2d2352017d
|
@ -102,7 +102,11 @@ class LoginCheckpointController extends AbstractLoginController
|
||||||
SecurityKey::getPsrRequestFactory($request)
|
SecurityKey::getPsrRequestFactory($request)
|
||||||
);
|
);
|
||||||
|
|
||||||
dd($source->getUserHandle());
|
if (!hash_equals($user->uuid, $source->getUserHandle())) {
|
||||||
|
throw new BadRequestHttpException('An unexpected error was encountered while validating that security key.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->sendLoginResponse($user, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,11 +88,7 @@ class SecurityKey extends Model
|
||||||
|
|
||||||
public function getPublicKeyCredentialDescriptor(): PublicKeyCredentialDescriptor
|
public function getPublicKeyCredentialDescriptor(): PublicKeyCredentialDescriptor
|
||||||
{
|
{
|
||||||
return new PublicKeyCredentialDescriptor(
|
return new PublicKeyCredentialDescriptor($this->type, $this->public_key_id, $this->transports);
|
||||||
$this->type,
|
|
||||||
$this->public_key_id,
|
|
||||||
$this->transports
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource
|
public function getPublicKeyCredentialSource(): PublicKeyCredentialSource
|
||||||
|
@ -105,7 +101,7 @@ class SecurityKey extends Model
|
||||||
$this->trust_path,
|
$this->trust_path,
|
||||||
$this->aaguid ?? Uuid::fromString(Uuid::NIL),
|
$this->aaguid ?? Uuid::fromString(Uuid::NIL),
|
||||||
$this->public_key,
|
$this->public_key,
|
||||||
(string) $this->user_id,
|
$this->user_handle,
|
||||||
$this->counter
|
$this->counter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ class PublicKeyCredentialSourceRepository implements PublicKeyRepositoryInterfac
|
||||||
{
|
{
|
||||||
/** @var \Pterodactyl\Models\SecurityKey $key */
|
/** @var \Pterodactyl\Models\SecurityKey $key */
|
||||||
$key = $this->user->securityKeys()
|
$key = $this->user->securityKeys()
|
||||||
->where('public_key_id', $id)
|
->where('public_key_id', base64_encode($id))
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
return optional($key)->getPublicKeyCredentialSource();
|
return optional($key)->getPublicKeyCredentialSource();
|
||||||
|
|
Loading…
Reference in New Issue