| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 25 |  |  | 25 |  | 17650 | use strict; | 
|  | 25 |  |  |  |  | 87 |  | 
|  | 25 |  |  |  |  | 883 |  | 
| 2 | 25 |  |  | 25 |  | 169 | use warnings; | 
|  | 25 |  |  |  |  | 65 |  | 
|  | 25 |  |  |  |  | 1445 |  | 
| 3 |  |  |  |  |  |  | package Net::SAML2::Role::ProtocolMessage; | 
| 4 |  |  |  |  |  |  | our $VERSION = '0.73'; # VERSION | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 25 |  |  | 25 |  | 11413 | use Moose::Role; | 
|  | 25 |  |  |  |  | 128335 |  | 
|  | 25 |  |  |  |  | 132 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | # ABSTRACT: Common behaviour for Protocol messages | 
| 9 |  |  |  |  |  |  |  | 
| 10 | 25 |  |  | 25 |  | 156427 | use namespace::autoclean; | 
|  | 25 |  |  |  |  | 71 |  | 
|  | 25 |  |  |  |  | 292 |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 25 |  |  | 25 |  | 28947 | use DateTime; | 
|  | 25 |  |  |  |  | 12940744 |  | 
|  | 25 |  |  |  |  | 1622 |  | 
| 13 | 25 |  |  | 25 |  | 282 | use MooseX::Types::URI qw/ Uri /; | 
|  | 25 |  |  |  |  | 69 |  | 
|  | 25 |  |  |  |  | 385 |  | 
| 14 | 25 |  |  | 25 |  | 71810 | use Net::SAML2::Util qw(generate_id); | 
|  | 25 |  |  |  |  | 504 |  | 
|  | 25 |  |  |  |  | 1481 |  | 
| 15 | 25 |  |  | 25 |  | 10007 | use Net::SAML2::Types qw(XsdID); | 
|  | 25 |  |  |  |  | 104 |  | 
|  | 25 |  |  |  |  | 143 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  | has id => ( | 
| 19 |  |  |  |  |  |  | isa     => XsdID, | 
| 20 |  |  |  |  |  |  | is      => 'ro', | 
| 21 |  |  |  |  |  |  | builder => "_build_id" | 
| 22 |  |  |  |  |  |  | ); | 
| 23 |  |  |  |  |  |  |  | 
| 24 |  |  |  |  |  |  | has issue_instant => ( | 
| 25 |  |  |  |  |  |  | isa     => 'Str', | 
| 26 |  |  |  |  |  |  | is      => 'ro', | 
| 27 |  |  |  |  |  |  | builder => '_build_issue_instant', | 
| 28 |  |  |  |  |  |  | ); | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | has issuer => ( | 
| 31 |  |  |  |  |  |  | isa      => Uri, | 
| 32 |  |  |  |  |  |  | is       => 'rw', | 
| 33 |  |  |  |  |  |  | required => 1, | 
| 34 |  |  |  |  |  |  | coerce   => 1, | 
| 35 |  |  |  |  |  |  | ); | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  | has issuer_namequalifier => ( | 
| 38 |  |  |  |  |  |  | isa       => 'Str', | 
| 39 |  |  |  |  |  |  | is        => 'rw', | 
| 40 |  |  |  |  |  |  | predicate => 'has_issuer_namequalifier', | 
| 41 |  |  |  |  |  |  | ); | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  | has issuer_format => ( | 
| 44 |  |  |  |  |  |  | isa => 'Str', | 
| 45 |  |  |  |  |  |  | is  => 'rw', | 
| 46 |  |  |  |  |  |  | predicate => 'has_issuer_format', | 
| 47 |  |  |  |  |  |  | ); | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | has destination => ( | 
| 50 |  |  |  |  |  |  | isa       => Uri, | 
| 51 |  |  |  |  |  |  | is        => 'rw', | 
| 52 |  |  |  |  |  |  | coerce    => 1, | 
| 53 |  |  |  |  |  |  | predicate => 'has_destination', | 
| 54 |  |  |  |  |  |  | ); | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  | sub _build_issue_instant { | 
| 57 | 37 |  |  | 37 |  | 64483 | return DateTime->now(time_zone => 'UTC')->strftime('%FT%TZ'); | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | sub _build_id { | 
| 61 | 13 |  |  | 13 |  | 73 | return generate_id(); | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | sub status_uri { | 
| 66 | 2 |  |  | 2 | 1 | 6 | my ($self, $status) = @_; | 
| 67 |  |  |  |  |  |  |  | 
| 68 | 2 |  |  |  |  | 12 | my $statuses = { | 
| 69 |  |  |  |  |  |  | success   => 'urn:oasis:names:tc:SAML:2.0:status:Success', | 
| 70 |  |  |  |  |  |  | requester => 'urn:oasis:names:tc:SAML:2.0:status:Requester', | 
| 71 |  |  |  |  |  |  | responder => 'urn:oasis:names:tc:SAML:2.0:status:Responder', | 
| 72 |  |  |  |  |  |  | partial   => 'urn:oasis:names:tc:SAML:2.0:status:PartialLogout', | 
| 73 |  |  |  |  |  |  | }; | 
| 74 |  |  |  |  |  |  |  | 
| 75 | 2 | 50 |  |  |  | 7 | if (exists $statuses->{$status}) { | 
| 76 | 2 |  |  |  |  | 16 | return $statuses->{$status}; | 
| 77 |  |  |  |  |  |  | } | 
| 78 |  |  |  |  |  |  |  | 
| 79 | 0 |  |  |  |  |  | return; | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | 1; | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | __END__ | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =pod | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | =encoding UTF-8 | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head1 NAME | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | Net::SAML2::Role::ProtocolMessage - Common behaviour for Protocol messages | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head1 VERSION | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | version 0.73 | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | Provides default ID and timestamp arguments for Protocol classes. | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | Provides a status-URI lookup method for the statuses used by this | 
| 103 |  |  |  |  |  |  | implementation. | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head1 NAME | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | Net::SAML2::Role::ProtocolMessage - the SAML2 ProtocolMessage Role object | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  | =head1 CONSTRUCTOR ARGUMENTS | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | =over | 
| 112 |  |  |  |  |  |  |  | 
| 113 |  |  |  |  |  |  | =item B<issuer> | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | URI of issuer | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | =item B<issuer_namequalifier> | 
| 118 |  |  |  |  |  |  |  | 
| 119 |  |  |  |  |  |  | NameQualifier attribute for Issuer | 
| 120 |  |  |  |  |  |  |  | 
| 121 |  |  |  |  |  |  | =item B<issuer_format> | 
| 122 |  |  |  |  |  |  |  | 
| 123 |  |  |  |  |  |  | Format attribute for Issuer | 
| 124 |  |  |  |  |  |  |  | 
| 125 |  |  |  |  |  |  | =item B<destination> | 
| 126 |  |  |  |  |  |  |  | 
| 127 |  |  |  |  |  |  | URI of Destination | 
| 128 |  |  |  |  |  |  |  | 
| 129 |  |  |  |  |  |  | =back | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =head1 METHODS | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | =head2 status_uri( $status ) | 
| 134 |  |  |  |  |  |  |  | 
| 135 |  |  |  |  |  |  | Provides a mapping from short names for statuses to the full status URIs. | 
| 136 |  |  |  |  |  |  |  | 
| 137 |  |  |  |  |  |  | Legal short names for B<$status> are: | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | =over | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | =item C<success> | 
| 142 |  |  |  |  |  |  |  | 
| 143 |  |  |  |  |  |  | =item C<requester> | 
| 144 |  |  |  |  |  |  |  | 
| 145 |  |  |  |  |  |  | =item C<responder> | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | =back | 
| 148 |  |  |  |  |  |  |  | 
| 149 |  |  |  |  |  |  | =head1 AUTHORS | 
| 150 |  |  |  |  |  |  |  | 
| 151 |  |  |  |  |  |  | =over 4 | 
| 152 |  |  |  |  |  |  |  | 
| 153 |  |  |  |  |  |  | =item * | 
| 154 |  |  |  |  |  |  |  | 
| 155 |  |  |  |  |  |  | Chris Andrews  <chrisa@cpan.org> | 
| 156 |  |  |  |  |  |  |  | 
| 157 |  |  |  |  |  |  | =item * | 
| 158 |  |  |  |  |  |  |  | 
| 159 |  |  |  |  |  |  | Timothy Legge <timlegge@gmail.com> | 
| 160 |  |  |  |  |  |  |  | 
| 161 |  |  |  |  |  |  | =back | 
| 162 |  |  |  |  |  |  |  | 
| 163 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | This software is copyright (c) 2023 by Venda Ltd, see the CONTRIBUTORS file for others. | 
| 166 |  |  |  |  |  |  |  | 
| 167 |  |  |  |  |  |  | This is free software; you can redistribute it and/or modify it under | 
| 168 |  |  |  |  |  |  | the same terms as the Perl 5 programming language system itself. | 
| 169 |  |  |  |  |  |  |  | 
| 170 |  |  |  |  |  |  | =cut |