Mojo/SAML/Document/NameIDPolicy.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 34 CC 5 SCAR 30.9
CC
5
Cov
0%
tag_attrs
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 22.0
1 package Mojo::SAML::Document::NameIDPolicy;
2  
3 use Mojo::Base 'Mojo::SAML::Document';
4  
5 use Mojo::SAML::Names;
6  
7 has template => sub { shift->build_template(<<'XML') };
8 %= tag NameIDPolicy => $self->tag_attrs
9 XML
10  
11 has [qw/allow_create format sp_name_qualifier/];
12  
13 sub tag_attrs {
14 my $self = shift;
15 my @attrs = (
16 xmlns => 'urn:oasis:names:tc:SAML:2.0:protocol',
17 );
18 if (defined(my $format = $self->format)) {
19 push @attrs, Format => Mojo::SAML::Names::nameid_format($format);
20 }
21 if (defined(my $qual = $self->sp_name_qualifier)) {
22 push @attrs, SPNameQualifier => $qual;
23 }
24 if (defined(my $create = $self->allow_create)) {
25 push @attrs, AllowCreate => $create ? 'true' : 'false';
26 }
27 return @attrs;
28 }
29  
30 1;
31  
32 =head1 NAME
33  
34 Mojo::SAML::Document::NameIDPolicy
35  
36 =head1 DESCRIPTION
37  
38 Represents an NameIDPolicy SAML protocol tag
39  
40 =head1 ATTRIBUTES
41  
42 L<Mojo::SAML::Document::NameIDPolicy> inherits all attributes from L<Mojo::SAML::Document> and implements the following new ones.
43  
44 =head2 allow_create
45  
46 Optional.
47 A boolean indicating whether the subject should be allowed to create an account if they don't already have one.
48 May be omitted, but assumed to be false if not given.
49  
50 =head2 format
51  
52 Optional.
53 The actual format, which may be shorted and then expanded via L<Mojo::SAML::Names/nameid_format>.
54 See that function for understood values, though more are possible.
55  
56 =head2 sp_name_qualifier
57  
58 Optional.
59 A namespace for the name to be returned (or created) other than the requester.
60  
61 =head2 template
62  
63 A template specific to the document type.
64  
65 =head1 METHODS
66  
67 L<Mojo::SAML::Document::NameIDPolicy> inherits all methods from L<Mojo::SAML::Document> and implements the following new ones.
68  
69 =head2 tag_attrs
70  
71 Generates a list of attributes for the tag.
72