Add script to create token
[scpubgit/stemmaweb.git] / t / script / make_json.pl
1 #!/usr/bin/env perl
2
3 use warnings;
4 use strict;
5 use JSON::MaybeXS;
6 use stemmaweb::Authentication::Credential::Google;
7 use Crypt::OpenSSL::RSA;
8
9 use IO::All;
10
11 my $cert = io('/home/erryk/certonly.pem')->slurp;
12 my $priv = io('/home/erryk/privkey')->slurp;
13
14 my $hash = { 'a' => $cert };
15
16 warn encode_json($hash) . "\n\n\n\n\n";
17
18 my $jwt = JSON::WebToken->encode({
19         sub          => '4242',
20         openid_id    => 'https://www.google.com/accounts/o8/id3',
21 }, $priv, 'RS256', { kid => 'a' });
22
23 use Data::Dumper;
24 warn $jwt . "\n\n\n\n\n";
25
26 warn Dumper (stemmaweb::Authentication::Credential::Google->decode($jwt, $hash));
27
28 1;