« blib/lib/Web/Authenticate/Session/Handler.pm
↑ Summary
blib/lib/Web/Authenticate/Authenticator/Redirect/Role.pm »
| 1 | use strict; | ||
| 2 | package Web::Authenticate::IpAddressProvider::EnvIpAddressProvider; | ||
| 3 | $Web::Authenticate::IpAddressProvider::EnvIpAddressProvider::VERSION = '0.004'; | ||
| 4 | use Mouse; | ||
| 5 | #ABSTRACT: Implementation of Web::Authentication::UserAgentProvider::Role that users environment variables. | ||
| 6 | |||
| 7 | with 'Web::Authenticate::IpAddressProvider::Role'; | ||
| 8 | |||
| 9 | |||
| 10 | sub get_ip_address { $ENV{HTTP_X_FORWARDED_FOR} ? $ENV{HTTP_X_FORWARDED_FOR} : $ENV{REMOTE_ADDR} } | ||
| 11 | |||
| 12 | 1; | ||
| 13 | |||
| 14 | __END__ | ||
| 15 | |||
| 16 | =pod | ||
| 17 | |||
| 18 | =encoding UTF-8 | ||
| 19 | |||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | Web::Authenticate::IpAddressProvider::EnvIpAddressProvider - Implementation of Web::Authentication::UserAgentProvider::Role that users environment variables. | ||
| 23 | |||
| 24 | =head1 VERSION | ||
| 25 | |||
| 26 | version 0.004 | ||
| 27 | |||
| 28 | =head1 METHODS | ||
| 29 | |||
| 30 | =head2 get_ip_address | ||
| 31 | |||
| 32 | Returns the user's ip address first using $ENV{HTTP_X_FORWARDED_FOR} if present, then $ENV{REMOTE_ADDR}. | ||
| 33 | |||
| 34 | =head1 AUTHOR | ||
| 35 | |||
| 36 | Adam Hopkins <srchulo@cpan.org> | ||
| 37 | |||
| 38 | =head1 COPYRIGHT AND LICENSE | ||
| 39 | |||
| 40 | This software is copyright (c) 2017 by Adam Hopkins. | ||
| 41 | |||
| 42 | This is free software; you can redistribute it and/or modify it under | ||
| 43 | the same terms as the Perl 5 programming language system itself. | ||
| 44 | |||
| 45 | =cut |