Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the /key/set request #48

Open
thejoelinux opened this issue Aug 26, 2022 · 1 comment
Open

Support for the /key/set request #48

thejoelinux opened this issue Aug 26, 2022 · 1 comment

Comments

@thejoelinux
Copy link

Relying parties who want to check the id_token validity against the public key issue a GET /ket/set on the OpenId Authorization Server/Provider.

We need a service to reply to this request with the public key.

@thejoelinux
Copy link
Author

thejoelinux commented Aug 26, 2022

I solved it by installing web-token/jwt-bundle and web-token/jwt-key-mgmt packages.

Configuring the service with :

jose:
    keys: # Configuration of the keys
        public: # Unique key name
            file: # Name of the method
                path: '%kernel.project_dir%/config/jwt/public.key'
                is_public: true
                additional_values: # Optional values.
                    use: 'sig'
                    alg: 'RS256'

And did a little symfony Controller like :

namespace App\Controller;

use Jose\Component\Core\JWK;
use Jose\Component\Core\JWKSet;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Routing\Annotation\Route;

class KeyController extends AbstractController
{
    #[Route('/openid/key/set')]
    public function decode(JWK $publicKey): JsonResponse
    {
        $keySet = new JWKSet([$publicKey]);
        return new JsonResponse($keySet->jsonSerialize());
    }
}

My route was /openid/key/set but feel free to modify it the way you want. Remember to type-hint correctly $publicKey (corresponding to the entry public in the YAML file).

Anyway it would be good to have this directly in the symfony bundle. I'll try to take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant