er::Registry::Auth::None->new;
};
use JSON::MaybeXS qw//;
has _json => (is => 'ro', default => sub {
JSON::MaybeXS->new;
});
sub process_json_response {
my ($self, $response) = @_;
if ($response->status == 200) {
my $struct = eval {
$self->_json->decode($response->content);
};
if ($@) {
Docker::Registry::Exception->throw({ message => $@ });
ss = 'Docker::Registry::Result::Repositories';
my $result = $result_class->new($self->process_json_response($response));
return $result;
}
sub repository_tags {
my $self = shift;
istry::Auth';
use Docker::Registry::Types qw(DockerRegistryURI);
use HTTP::Tiny;
use JSON::MaybeXS qw(decode_json);
has username => (
is => 'ro',
isa => Str,
required => 1,
);
TTP::Tiny->new();
my $res = $ua->get($uri);
if ($res->{success}) {
return decode_json($res->{content})->{token};
}
die "Unable to get token from gitlab!";
}
sub authorize {
r_token);
$request->header('Accept',
'application/vnd.docker.distribution.manifest.v2+json');
return $request;
}
__PACKAGE__->meta->make_immutable;
__END__
=head1 DESCRIPTION
Auth
code_jwt/;
use JSON::MaybeXS;
use Path::Class;
use URI;
use HTTP::Tiny;
has service_account_file => (is => 'ro', isa => Str, default => sub {
"$ENV{HOME}/.gcloud/sd.json"
});
has s
hift;
my $f = Path::Class::File->new($self->service_account_file);
my $json = JSON::MaybeXS->new;
return $json->decode(join '', $f->slurp);
});
has client_email => (is => 'ro', isa =>
$result) = @_;
my $json = eval { decode_json($result->{ content }) };
if (not $json) {
Docker::Registry::Auth::Exception->throw({
message => "Couldn't json-parse $result->{ conte
Docker::Registry::Auth::AzureServicePrincipal;
use Moo;
with 'Docker::Registry::Auth';
use JSON::MaybeXS;
use Azure::AD::ClientCredentials;
has ad_auth => (
is => 'ro',
default =>
nse code: $response->{ status }" if (not $response->{ success });
my $refresh_token = decode_json($response->{ content })->{ refresh_token };
$response = $self->ua->post_form(
$params{
=> $scope,
refresh_token => $refresh_token,
}
);
my $access_token = decode_json($response->{ content })->{ access_token };
$request->header('Authorization', 'Bearer ' . $ac