/** * Displays the JSON web key for this installation. */ public function jwks() { $config = $this->f3->get('config'); if (!isset($config['public_jwks_file'])) { $this->f3->status(404); $this->fatalError($this->t('No web key file found.')); } $set = new KeySet(); $set->load(file_get_contents($config['public_jwks_file'])); if (!$set->isPublic()) { $this->f3->status(401); $this->fatalError($this->t('Web key file not public.')); } header('Content-Type: application/jwk-set+json'); header('Content-Disposition: inline; filename=jwks.json'); print $set->toJWKS(); }
/** * Adds the server's public keys. * * @return KeySetBuilder */ function addServerPublicKeys() { $f3 = Base::instance(); $config = $f3->get('config'); if (isset($config['public_jwks_file'])) { $server_jwks = new KeySet(); $server_jwks->load(file_get_contents($config['public_jwks_file'])); $this->set->addAll($server_jwks); } return $this; }
protected function loadKeySet($jwks) { $set = new KeySet(); $set->load($jwks, $this->password); return $set; }