File Coverage

blib/lib/Stancer/Auth.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 27 27 100.0


line stmt bran cond sub pod time code
1             package Stancer::Auth;
2              
3 17     17   1092221 use 5.020;
  17         69  
4 17     17   107 use strict;
  17         52  
  17         463  
5 17     17   76 use warnings;
  17         32  
  17         1533  
6              
7             # ABSTRACT: Authentication configuration
8             our $VERSION = '1.0.3'; # VERSION
9              
10 17     17   3295 use Stancer::Core::Types qw(Maybe Str Url);
  17         49  
  17         1692  
11              
12 17     17   136 use Moo;
  17         48  
  17         132  
13              
14             extends 'Stancer::Core::Object';
15              
16 17     17   7545 use namespace::clean;
  17         41  
  17         105  
17              
18 17     17   14400 use Stancer::Auth::Status;
  17         59  
  17         2479  
19              
20              
21             has redirect_url => (
22             is => 'rwp',
23             isa => Maybe[Url],
24             );
25              
26              
27             has return_url => (
28             is => 'rw',
29             isa => Maybe[Url],
30             trigger => sub { $_[0]->_add_modified('return_url') },
31             );
32              
33              
34             has status => (
35             is => 'rwp',
36             isa => Maybe[Str],
37             default => Stancer::Auth::Status::REQUEST,
38             );
39              
40             1;
41              
42             __END__
43              
44             =pod
45              
46             =encoding UTF-8
47              
48             =head1 NAME
49              
50             Stancer::Auth - Authentication configuration
51              
52             =head1 VERSION
53              
54             version 1.0.3
55              
56             =head1 ATTRIBUTES
57              
58             =head2 C<redirect_url>
59              
60             Read-only HTTPS url.
61              
62             Location of the page which will start authentication process.
63              
64             =head2 C<return_url>
65              
66             Read/write HTTPS url.
67              
68             Location of the page which will receive authentication response.
69              
70             =head2 C<status>
71              
72             Read-only string.
73              
74             Authentication status.
75              
76             =head1 METHODS
77              
78             =head2 C<< Stancer::Auth->new() : I<self> >>
79              
80             =head2 C<< Stancer::Auth->new(I<%args>) : I<self> >>
81              
82             =head2 C<< Stancer::Auth->new(I<\%args>) : I<self> >>
83              
84             This method accept an optional string, it will be used as an entity ID for API calls.
85              
86             # Get an empty new authentication configuration
87             my $new = Stancer::Auth->new();
88              
89             =head1 USAGE
90              
91             =head2 Logging
92              
93              
94              
95             We use the L<Log::Any> framework for logging events.
96             You may tell where it should log using any available L<Log::Any::Adapter> module.
97              
98             For example, to log everything to a file you just have to add a line to your script, like this:
99             #! /usr/bin/env perl
100             use Log::Any::Adapter (File => '/var/log/payment.log');
101             use Stancer::Auth;
102              
103             You must import C<Log::Any::Adapter> before our libraries, to initialize the logger instance before use.
104              
105             You can choose your log level on import directly:
106             use Log::Any::Adapter (File => '/var/log/payment.log', log_level => 'info');
107              
108             Read the L<Log::Any> documentation to know what other options you have.
109              
110             =cut
111              
112             =head1 SECURITY
113              
114             =over
115              
116             =item *
117              
118             Never, never, NEVER register a card or a bank account number in your database.
119              
120             =item *
121              
122             Always uses HTTPS in card/SEPA in communication.
123              
124             =item *
125              
126             Our API will never give you a complete card/SEPA number, only the last four digits.
127             If you need to keep track, use these last four digit.
128              
129             =back
130              
131             =cut
132              
133             =head1 BUGS
134              
135             Please report any bugs or feature requests on the bugtracker website
136             L<https://gitlab.com/wearestancer/library/lib-perl/-/issues> or by email to
137             L<bug-stancer@rt.cpan.org|mailto:bug-stancer@rt.cpan.org>.
138              
139             When submitting a bug or request, please include a test-file or a
140             patch to an existing test-file that illustrates the bug or desired
141             feature.
142              
143             =head1 AUTHOR
144              
145             Joel Da Silva <jdasilva@cpan.org>
146              
147             =head1 COPYRIGHT AND LICENSE
148              
149             This software is Copyright (c) 2018-2024 by Stancer / Iliad78.
150              
151             This is free software, licensed under:
152              
153             The Artistic License 2.0 (GPL Compatible)
154              
155             =cut