Hi,

Trying to translate the following curl command to Mojo::UserAgent:

curl -H "Content-type: application/json" -X POST \
--data-binary @radzmgr.json \
--cert /etc/rad/cert.pem --key /etc/rad/key.pem -k \
https://localhost:12303/api/com.oracle.solaris.rad.authentication/1.0/Session 
\
-v -c cookie.txt -b cookie.txt

The contents of radzmgr.json is the authentication fragment:

{
      "username": "radzmgr",
      "password": "password",
      "scheme": "pam",
      "preserve": true,
      "timeout": -1
}

I have the following code that is not throwing errors:

#!/usr/bin/perl

use v5.10;
use warnings;
use strict;
use feature "say";
use Data::Dumper;

use Mojo::UserAgent;


IO::Socket::SSL::set_defaults(SSL_verify_mode => 'VERIFY_NONE');
my $ua = Mojo::UserAgent->new;

$ua = $ua->ca('/etc/rad/cert.pem');
$ua = $ua->key('/etc/rad/key.pem');

my $cookie_jar = $ua->cookie_jar;

my $tx =
$ua->post('https://localhost:12303/api/com.oracle.solaris.rad.authentication/1.0/Session'
 
=> {'Content-Type' => 'application/json'} => 
'{
      "username": "radzmgr",
      "password": "sun2sun",
      "scheme": "pam",
      "preserve": true,
      "timeout": -1
}'
);

Again, error free, but I can't figure out if I have a reasonable cookie in 
the cookie jar. Any help on determining what is in the cookie jar.

The next curl command needs to use the cookie to perform an operation:

curl -H "Content-type: application/json" -X PUT \
--data @zones.json --cert /etc/rad/cert.pem --key /etc/rad/key.pem -k \
https://localhost:12303/api/com.oracle.solaris.rad.zonemgr/1.2/Zone/azone/_rad_method/boot
 
\
-b cookie.txt

Any help on this or what to read would be appreciated!

JIM


-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to