File Coverage

blib/lib/Net/SAML2/Protocol/ArtifactResolve.pm
Criterion Covered Total %
statement 11 11 100.0
branch n/a
condition 1 2 50.0
subroutine 3 3 100.0
pod 1 1 100.0
total 16 17 94.1


line stmt bran cond sub pod time code
1             package Net::SAML2::Protocol::ArtifactResolve;
2 2     2   8292 use Moose;
  2         6  
  2         18  
3 2     2   15472 use MooseX::Types::URI qw/ Uri /;
  2         5  
  2         28  
4              
5             with 'Net::SAML2::Role::ProtocolMessage';
6              
7             our $VERSION = '0.42';
8              
9             # ABSTRACT: Net::SAML2::Protocol::ArtifactResolve - ArtifactResolve protocol class
10              
11              
12              
13             has 'issuer' => (isa => 'Str', is => 'ro', required => 1);
14             has 'destination' => (isa => 'Str', is => 'ro', required => 1);
15             has 'artifact' => (isa => 'Str', is => 'ro', required => 1);
16             has 'provider' => (isa => 'Str', is => 'ro', required => 0);
17              
18              
19             sub as_xml {
20 1     1 1 823 my ($self) = @_;
21              
22 1         9 my $x = XML::Generator->new(':pretty');
23 1         193 my $saml = ['saml' => 'urn:oasis:names:tc:SAML:2.0:assertion'];
24 1         4 my $samlp = ['samlp' => 'urn:oasis:names:tc:SAML:2.0:protocol'];
25              
26 1   50     5 $x->xml(
27             $x->ArtifactResolve(
28             $samlp,
29             { ID => $self->id,
30             IssueInstant => $self->issue_instant,
31             Destination => $self->destination,
32             ProviderName => $self->provider || "My SP's human readable name.",
33             Version => '2.0' },
34             $x->Issuer(
35             $saml,
36             $self->issuer,
37             ),
38             $x->Artifact(
39             $samlp,
40             $self->artifact,
41             ),
42             )
43             );
44             }
45              
46             __PACKAGE__->meta->make_immutable;
47              
48             __END__
49              
50             =pod
51              
52             =encoding UTF-8
53              
54             =head1 NAME
55              
56             Net::SAML2::Protocol::ArtifactResolve - Net::SAML2::Protocol::ArtifactResolve - ArtifactResolve protocol class
57              
58             =head1 VERSION
59              
60             version 0.42
61              
62             =head1 SYNOPSIS
63              
64             my $resolver = Net::SAML2::Binding::ArtifactResolve->new(
65             issuer => 'http://localhost:3000',
66             );
67              
68             my $response = $resolver->resolve(params->{SAMLart});
69              
70             =head1 NAME
71              
72             Net::SAML2::Protocol::ArtifactResolve - ArtifactResolve protocol class.
73              
74             =head1 METHODS
75              
76             =head2 new( ... )
77              
78             Constructor. Returns an instance of the ArtifactResolve request for
79             the given issuer and artifact.
80              
81             Arguments:
82              
83             =over
84              
85             =item B<issuer>
86              
87             issuing SP's identity URI
88              
89             =item B<artifact>
90              
91             artifact to be resolved
92              
93             =item B<destination>
94              
95             IdP's identity URI
96              
97             =back
98              
99             =head2 as_xml( )
100              
101             Returns the ArtifactResolve request as XML.
102              
103             =head1 AUTHOR
104              
105             Chris Andrews <chrisa@cpan.org>
106              
107             =head1 COPYRIGHT AND LICENSE
108              
109             This software is copyright (c) 2021 by Chris Andrews and Others, see the git log.
110              
111             This is free software; you can redistribute it and/or modify it under
112             the same terms as the Perl 5 programming language system itself.
113              
114             =cut