| 1 | package Mojo::SAML::Document::KeyDescriptor; | ||
| 2 | |||
| 3 | use Mojo::Base 'Mojo::SAML::Document'; | ||
| 4 | |||
| 5 | has template => sub { shift->build_template(<<'XML') }; | ||
| 6 | % my @attrs = (xmlns => 'urn:oasis:names:tc:SAML:2.0:metadata'); | ||
| 7 | % if (my $use = $self->use) { push @attrs, (use => $use) } | ||
| 8 | %= tag KeyDescriptor => @attrs => begin | ||
| 9 | <%= $self->key_info %> | ||
| 10 | % end | ||
| 11 | XML | ||
| 12 | |||
| 13 | has key_info => sub { Carp::croak 'key_info is required' }; | ||
| 14 | has 'use'; | ||
| 15 | |||
| 16 | 1; | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | Mojo::SAML::Document::KeyDescriptor | ||
| 21 | |||
| 22 | =head1 DESCRIPTION | ||
| 23 | |||
| 24 | Represents an KeyDescriptor SAML metadata tag | ||
| 25 | |||
| 26 | =head1 ATTRIBUTES | ||
| 27 | |||
| 28 | L<Mojo::SAML::Document::KeyDescriptor> inherits all attributes from L<Mojo::SAML::Document> and implements the following new ones. | ||
| 29 | |||
| 30 | =head2 key_info | ||
| 31 | |||
| 32 | Required. | ||
| 33 | An instance of L<Mojo::SAML::Document::KeyInfo> containing information about the relevant key. | ||
| 34 | |||
| 35 | =head2 template | ||
| 36 | |||
| 37 | A template specific to the document type. | ||
| 38 | |||
| 39 | =head2 use | ||
| 40 | |||
| 41 | A string indicating if this key is used for C<signing> or C<encryption>. | ||
| 42 | This field should be optional, and when omitted it should indicate that the key is used for both uses. | ||
| 43 | In practice, the author has seen services that require that if a key is used for both purposes, it should be specified twice, once for each use. | ||
| 44 |