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