| 1 | package OAuthomatic::OAuthInteraction::ViaMicroWeb; | ||
| 2 | # ABSTRACT: Handling oauth callback via embedded web server | ||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | use Moose; | ||
| 7 | use namespace::sweep; | ||
| 8 | use Proc::Background; | ||
| 9 | use Carp; | ||
| 10 | |||
| 11 | |||
| 12 | has 'micro_web' => (is=>'ro', isa=>'OAuthomatic::Internal::MicroWeb', required=>1, | ||
| 13 | handles => [ 'callback_url', 'wait_for_oauth_grant' ]); | ||
| 14 | |||
| 15 | sub prepare_to_work { | ||
| 16 | my $self = shift; | ||
| 17 | $self->micro_web->start_using; | ||
| 18 | return; | ||
| 19 | } | ||
| 20 | |||
| 21 | sub cleanup_after_work { | ||
| 22 | my $self = shift; | ||
| 23 | $self->micro_web->finish_using; | ||
| 24 | return; | ||
| 25 | } | ||
| 26 | |||
| 27 | with 'OAuthomatic::OAuthInteraction'; | ||
| 28 | |||
| 29 | 1; | ||
| 30 | |||
| 31 | __END__ | ||
| 32 | |||
| 33 | =pod | ||
| 34 | |||
| 35 | =encoding UTF-8 | ||
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | OAuthomatic::OAuthInteraction::ViaMicroWeb - Handling oauth callback via embedded web server | ||
| 40 | |||
| 41 | =head1 VERSION | ||
| 42 | |||
| 43 | version 0.0201 | ||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | This module uses in-process web server to handle callback after OAuth permission | ||
| 48 | is granted. Used as default implementation of C<oauth_interaction> plugin | ||
| 49 | of L<OAuthomatic>. | ||
| 50 | |||
| 51 | =head1 PARAMETERS | ||
| 52 | |||
| 53 | =head2 micro_web | ||
| 54 | |||
| 55 | Embedded web server object. Here it will be used to handle OAuth callback and display | ||
| 56 | minimal info to the user afterwards. | ||
| 57 | |||
| 58 | =head1 AUTHOR | ||
| 59 | |||
| 60 | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> | ||
| 61 | |||
| 62 | =head1 COPYRIGHT AND LICENSE | ||
| 63 | |||
| 64 | This software is copyright (c) 2015 by Marcin Kasperski. | ||
| 65 | |||
| 66 | This is free software; you can redistribute it and/or modify it under | ||
| 67 | the same terms as the Perl 5 programming language system itself. | ||
| 68 | |||
| 69 | =cut |