/**
  * @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()));
 }
Example #2
0
 function testArrayInput()
 {
     $key = array('kty' => 'RSA', 'e' => 'AQAB', 'n' => 'x9vNhcvSrxjsegZAAo4OEuoZOV_oxINEeWneJYcz...');
     $jwks = new JOSE_JWKSet($key);
     $this->assertEquals('{"keys":[{"kty":"RSA","e":"AQAB","n":"x9vNhcvSrxjsegZAAo4OEuoZOV_oxINEeWneJYcz..."}]}', $jwks->toString());
 }