Bundle-WATERKIP

 view release on metacpan or  search on metacpan

lib/Bundle/WATERKIP/CLI/Azure/Password.pm  view on Meta::CPAN

package Bundle::WATERKIP::CLI::Azure::Password;
our $VERSION = '0.003';
use Moo;
use namespace::autoclean;
with 'YA::CLI::ActionRole';
use feature qw(say state);

use Azure::AD::Password;
use LWP::UserAgent;
use Types::Standard qw(InstanceOf Enum Str);

sub usage_pod { 1 }

# Allow trailing slashes
state $res_id = Enum(
  [
    qw(
      https://graph.windows.net
      https://management.core.windows.net
      https://graph.windows.net/
      https://management.core.windows.net/
    )
  ]
);

# ABSTRACT: Get Password JWT

has ad => (
  is      => 'ro',
  isa     => InstanceOf[ 'Azure::AD::Password' ],
  lazy    => 1,
  builder => 1,
);

has resource_id => (
    is => 'ro',
    isa => Str,
    default => 'https://graph.windows.net'
);

sub _build_ad {
  my $self = shift;
  return Azure::AD::Password->new(
    %{$self->_cli_args},
    resource_id => $self->resource_id,
  );
}

sub cli_options {
  return (
    'resource_id|resource-id=s', 'client_id|client-id=s',
    'tenant_id|tenant-id=s',     'username=s',
    'password=s',
    'use_at|use-at=s',
  );
}

sub action { 'password' }

sub run {
  my $self = shift;

  my $token = $self->ad->access_token;



( run in 1.908 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )