jwt-framework icon indicating copy to clipboard operation
jwt-framework copied to clipboard

Do not deprecate the support for PSR-18 HTTP clients

Open Cyperghost opened this issue 1 year ago • 1 comments

Description

https://github.com/web-token/jwt-framework/blob/1dbef13afb91a576d5ce431e5f9570183b19c0dd/src/Library/KeyManagement/UrlKeySetFactory.php#L22-L31

In our application we use Guzzle and not any feature of Symfony. Is there any point that you can support PSR-18 HTTP clients too?

It would be good to have the same solutions as https://github.com/web-auth/webauthn-framework/issues/482 Another solution would be to move UrlKeySetFactory to the bundle.

Example

No response

Cyperghost avatar Feb 28 '24 13:02 Cyperghost

Hi,

Actually, the JKUFactory and the X5UFactory can be easily extended to be used with any HTTP Client. In version 4.0, symfony/http-client will be mandatory only if you use the classes, but you are free to implement your own class.


namespace Acme;

use GuzzleHttp\Client;
use Jose\Component\KeyManagement\JKUFactory;

final class GuzzleJKUFactory extends JKUFactory
 {
    pulbic function __construct(private readonly Client $client) {}

    /**
     * @param array<string, string|string[]> $header
     */
    protected function getContent(string $url, array $header = []): string
    {
        //Place Guzzle calls here
        $this->client->request(...
    }
}

Spomky avatar Feb 28 '24 20:02 Spomky