Skip to content

Instantly share code, notes, and snippets.

View jaimeperez's full-sized avatar

Jaime Pérez Crespo jaimeperez

  • Trondheim
View GitHub Profile
@jaimeperez
jaimeperez / gist:d53874daa52bf42ac712aa368643f338
Created September 24, 2019 10:18
How to return different responses from a controller
// if the response is XML:
$response = new \Symfony\Component\HttpFoundation\Response();
$response->setContent($xml);
return $response;
// if the response is a twig template:
$template = new \SimpleSAML\XHTML\Template('whatever.twig');
$template->data = ['foo' => 'bar'];
return $template;
@jaimeperez
jaimeperez / encrypt.php
Created August 17, 2017 12:36
A script to encrypt two-factor authenticator secrets for Feide
<?php
include("vendor/autoload.php");
// JSON-encode the Authenticator secret
$plaintext = array("secret" => "<AUTHENTICATOR_SECRET");
// initialize JWE object
$jwe = new JOSE_JWE(json_encode($plaintext));
// encrypt with Feide's key and proper algorithms
### Keybase proof
I hereby claim:
* I am jaimeperez on github.
* I am jaimeperez (https://keybase.io/jaimeperez) on keybase.
* I have a public key whose fingerprint is 9A08 EA20 E062 70B4 616B 43E3 562A FE3A 6293 62C2
To claim this, I am signing this object: