From: Errietta Kostala Date: Wed, 28 Jan 2015 10:33:03 +0000 (+0000) Subject: Add script to create token X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2Fstemmaweb.git;a=commitdiff_plain;h=bb1f8a404fd1748d7f1c727cd660b928e17434ae Add script to create token --- diff --git a/t/script/make_json.pl b/t/script/make_json.pl new file mode 100644 index 0000000..dfb76fd --- /dev/null +++ b/t/script/make_json.pl @@ -0,0 +1,28 @@ +#!/usr/bin/env perl + +use warnings; +use strict; +use JSON::MaybeXS; +use stemmaweb::Authentication::Credential::Google; +use Crypt::OpenSSL::RSA; + +use IO::All; + +my $cert = io('/home/erryk/certonly.pem')->slurp; +my $priv = io('/home/erryk/privkey')->slurp; + +my $hash = { 'a' => $cert }; + +warn encode_json($hash) . "\n\n\n\n\n"; + +my $jwt = JSON::WebToken->encode({ + sub => '4242', + openid_id => 'https://www.google.com/accounts/o8/id3', +}, $priv, 'RS256', { kid => 'a' }); + +use Data::Dumper; +warn $jwt . "\n\n\n\n\n"; + +warn Dumper (stemmaweb::Authentication::Credential::Google->decode($jwt, $hash)); + +1;