<commit_before><?php

namespace LoginCidadao\OpenIDBundle\Controller;

use FOS\RestBundle\Controller\Annotations as REST;
use Symfony\Component\HttpFoundation\JsonResponse;
use FOS\RestBundle\Controller\FOSRestController;
use phpseclib\Crypt\RSA;

/**
 * @REST\Route("/openid/connect")
 */
class JsonWebKeyController extends FOSRestController
{

    /**
     * @REST\Get("/jwks", name="oidc_jwks", defaults={"_format"="json"})
     * @REST\View(templateVar="jwks")
     */
    public function getAction()
    {
        $keyStorage = $this->get('oauth2.storage.public_key');
        $pubKey    = new RSA();
        $pubKey->loadKey($keyStorage->getPublicKey());
        $publicKey = \JOSE_JWK::encode($pubKey);

        $jwks = new \JOSE_JWKSet(array($publicKey));

        return new JsonResponse(json_decode($jwks->toString()));
    }
}<commit_msg>Added kid field to JWKS #235<commit_after><?php

namespace LoginCidadao\OpenIDBundle\Controller;

use FOS\RestBundle\Controller\Annotations as REST;
use Symfony\Component\HttpFoundation\JsonResponse;
use FOS\RestBundle\Controller\FOSRestController;
use phpseclib\Crypt\RSA;

/**
 * @REST\Route("/openid/connect")
 */
class JsonWebKeyController extends FOSRestController
{

    /**
     * @REST\Get("/jwks", name="oidc_jwks", defaults={"_format"="json"})
     * @REST\View(templateVar="jwks")
     */
    public function getAction()
    {
        $keyStorage = $this->get('oauth2.storage.public_key');
        $pubKey     = new RSA();
        $pubKey->loadKey($keyStorage->getPublicKey());
        $publicKey  = \JOSE_JWK::encode($pubKey);

        $publicKey->components['kid'] = 'pub';

        $jwks = new \JOSE_JWKSet(array($publicKey));

        return new JsonResponse(json_decode($jwks->toString()));
    }
}
{'fraction_non_alphanumeric': 0.15768576290414066, 'fraction_numerical': 0.0028360748723766306, 'mean_word_length': 3.7804878048780486, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7660053', 'n_tokens_mistral': 610, 'n_tokens_neox': 580, 'n_words': 85}