| 1 | package OpenID::Lite::Association; | ||
| 2 | |||
| 3 | 3 | ▶ | use Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 3 | ▶ | use OpenID::Lite::Types qw(AssocType SessionType); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 3 | ▶ | use OpenID::Lite::Constants::AssocType qw(HMAC_SHA1 HMAC_SHA256); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 3 | ▶ | use String::Random; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 3 | ▶ | use MIME::Base64; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | has 'handle' => ( | |
| 11 | is => 'rw', | ||
| 12 | isa => 'Str', | ||
| 13 | required => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | 3 | has 'secret' => ( | |
| 17 | is => 'rw', | ||
| 18 | isa => 'Str', | ||
| 19 | required => 1, | ||
| 20 | ); | ||
| 21 | |||
| 22 | 3 | has 'type' => ( | |
| 23 | is => 'rw', | ||
| 24 | isa => AssocType, | ||
| 25 | required => 1, | ||
| 26 | ); | ||
| 27 | |||
| 28 | 3 | has 'expires_in' => ( | |
| 29 | is => 'rw', | ||
| 30 | isa => 'Int', | ||
| 31 | required => 1, | ||
| 32 | ); | ||
| 33 | |||
| 34 | 3 | has 'issued' => ( | |
| 35 | is => 'rw', | ||
| 36 | isa => 'Int', | ||
| 37 | required => 1, | ||
| 38 | ); | ||
| 39 | |||
| 40 | 9 | ▶ | sub copy { |
|
Subroutine
copy: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 41 | 9 | my $self = shift; | |
| 42 | 9 | return ref($self)->new( | |
| 43 | handle => $self->handle, | ||
| 44 | secret => $self->secret, | ||
| 45 | type => $self->type, | ||
| 46 | expires_in => $self->expires_in, | ||
| 47 | issued => $self->issued, | ||
| 48 | ); | ||
| 49 | } | ||
| 50 | |||
| 51 | 4 | ▶ | sub expires_at { |
|
Subroutine
expires_at: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 52 | 4 | my $self = shift; | |
| 53 | 4 | return ( $self->issued + $self->expires_in ); | |
| 54 | } | ||
| 55 | |||
| 56 | 4 | ▶ | sub is_expired { |
|
Subroutine
is_expired: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 57 | 4 | my $self = shift; | |
| 58 | 4 | return ( $self->expires_at < time() ); | |
| 59 | } | ||
| 60 | |||
| 61 | 3 | ▶ | no Any::Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 62 | 3 | __PACKAGE__->meta->make_immutable; | |
| 63 | 3 | 1; | |
| 64 | |||
| 65 | =head1 NAME | ||
| 66 | |||
| 67 | OpenID::Lite::Association - Association class | ||
| 68 | |||
| 69 | =head1 SYNOPSIS | ||
| 70 | |||
| 71 | $assoc->handle; | ||
| 72 | $assoc->secret; | ||
| 73 | $assoc->type; | ||
| 74 | $assoc->expires_in; | ||
| 75 | $assoc->issued; | ||
| 76 | $assoc->expires_at; | ||
| 77 | $assoc->is_expires; | ||
| 78 | $assoc->copy; | ||
| 79 | |||
| 80 | =head1 DESCRIPTION | ||
| 81 | |||
| 82 | This class's object represents association that established between RP and OP. | ||
| 83 | You don't need to build association by yourself. | ||
| 84 | |||
| 85 | =head1 AUTHOR | ||
| 86 | |||
| 87 | Lyo Kato, E<lt>lyo.kato@gmail.comE<gt> | ||
| 88 | |||
| 89 | =head1 COPYRIGHT AND LICENSE | ||
| 90 | |||
| 91 | Copyright (C) 2009 by Lyo Kato | ||
| 92 | |||
| 93 | This library is free software; you can redistribute it and/or modify | ||
| 94 | it under the same terms as Perl itself, either Perl version 5.8.8 or, | ||
| 95 | at your option, any later version of Perl 5 you may have available. | ||
| 96 | |||
| 97 | =cut | ||