Key Set Management (JWKSet)
Key Sets As Services
All these methods have the following common option:
is_public
: set the service public or private.
The key set configuration will look like as follow:
The key set will be available as a container service with the ID jose.key_set.keyset_name
where keyset_name
is the unique name of your key set. Each key set service will be an instance of the Jose\Component\Core\JWKSet
class.
As any other configuration values, you can use environment variables.
From A JWKSet Object
This method will directly get a JWKSet object.
Distant Key Sets
You can load key sets shared by a distant service (e.g. Google, Microsoft, Okta...). You must install and enable the Symfony Http Client.
When done, you have to create a client and enable the JKU Factory service by indicating the request factory service to use:
Important recommendations:
It is highly recommended to use a cache plugin for your HTTP client and thus avoid unnecessary calls to the key set endpoint.
The connection must be secured and certificate verification should not be disabled.
From A JKU (JWK Url)
The following example will allow you tu load a key set from a distant URI. The key set must be a JWKSet object.
From A X5U (X509 Certificates Url)
The following example will allow you tu load a key set from a distant URI. The key set must be a list of X509 certificates.
Shared Key Sets
It can be interesting to share your key sets through an Url. This can easily achieved by adding a dedicated controller. This controller is automatically created by the bundle.
You can enable these routes by adding the following configuration to your routing file.
Then you can share your key set.
Now when you go to the URL http://128.0.0.1:8000/certs
, you will get your key set.
Custom Tags
You can add custom tags and attributes to the services you create.
Last updated