| 1 | package OAuthomatic::SecretStorage; | ||
| 2 | # ABSTRACT: Save and restore confidential OAuth tokens | ||
| 3 | |||
| 4 | 7 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 7 | ▶ | use OAuthomatic::Types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 7 | ▶ | use namespace::sweep; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | |||
| 9 | # FIXME: SecretStorage/Fixed - implement and mention here | ||
| 10 | |||
| 11 | |||
| 12 | 7 | requires 'get_client_cred'; | |
| 13 | |||
| 14 | |||
| 15 | 7 | requires 'save_client_cred'; | |
| 16 | |||
| 17 | |||
| 18 | 7 | requires 'clear_client_cred'; | |
| 19 | |||
| 20 | |||
| 21 | 7 | requires 'get_token_cred'; | |
| 22 | |||
| 23 | |||
| 24 | 7 | requires 'save_token_cred'; | |
| 25 | |||
| 26 | |||
| 27 | 7 | requires 'clear_token_cred'; | |
| 28 | |||
| 29 | 7 | 1; | |
| 30 | |||
| 31 | __END__ | ||
| 32 | |||
| 33 | =pod | ||
| 34 | |||
| 35 | =encoding UTF-8 | ||
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | OAuthomatic::SecretStorage - Save and restore confidential OAuth tokens | ||
| 40 | |||
| 41 | =head1 VERSION | ||
| 42 | |||
| 43 | version 0.0201 | ||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | Interface defining methods used to save and restore various | ||
| 48 | credentials. Implementations should use some kind of reasonably secure | ||
| 49 | persistent storage, to preserve data over reruns. | ||
| 50 | |||
| 51 | Note: methods below are parameterless (except saved tokens), but | ||
| 52 | should operate on access to specific remote site. Typical | ||
| 53 | implementation would have required parameers like C<site_name> and | ||
| 54 | C<password_group> in the constructor. | ||
| 55 | |||
| 56 | See L<OAuthomatic::SecretStorage::Keyring> for default implementation | ||
| 57 | (and example). | ||
| 58 | |||
| 59 | =head1 METHODS | ||
| 60 | |||
| 61 | =head2 get_client_cred() => ClientCred(...) | ||
| 62 | |||
| 63 | Return saved client tokens (client_key, client_secret), or undef if | ||
| 64 | those were not (yet) saved. Returns L<OAuthomatic::Types::ClientCred>. | ||
| 65 | |||
| 66 | =head2 save_client_cred(client_cred) | ||
| 67 | |||
| 68 | Save client tokens for future use. | ||
| 69 | |||
| 70 | Parameter is L<OAuthomatic::Types::ClientCred>. | ||
| 71 | |||
| 72 | Never called if L<get_client_cred> always returns some data. This method is used to save | ||
| 73 | keys user provided after beint interactively asked. | ||
| 74 | |||
| 75 | =head2 clear_client_cred() | ||
| 76 | |||
| 77 | Clear client tokens, if any are saved. | ||
| 78 | |||
| 79 | Called in case restored tokens turn out invalid, expired, etc. | ||
| 80 | |||
| 81 | =head2 get_token_cred() => TokenCred(...) | ||
| 82 | |||
| 83 | Restore previously saved token and secret (access token, access | ||
| 84 | secret), or undef if those were not (yet) saved. Returns | ||
| 85 | L<OAuthomatic::Types::ClientCred>. | ||
| 86 | |||
| 87 | =head2 save_token_cred(token_cred) | ||
| 88 | |||
| 89 | Saves token for future use, to be preserved over program restarts. | ||
| 90 | Parameter is of type L<OAuthomatic::Types::ClientCred>. | ||
| 91 | |||
| 92 | =head2 clear_token_cred() | ||
| 93 | |||
| 94 | Clear token, if it was saved. Called in case token is found to be | ||
| 95 | wrong or expired. | ||
| 96 | |||
| 97 | =head1 AUTHOR | ||
| 98 | |||
| 99 | Marcin Kasperski <Marcin.Kasperski@mekk.waw.pl> | ||
| 100 | |||
| 101 | =head1 COPYRIGHT AND LICENSE | ||
| 102 | |||
| 103 | This software is copyright (c) 2015 by Marcin Kasperski. | ||
| 104 | |||
| 105 | This is free software; you can redistribute it and/or modify it under | ||
| 106 | the same terms as the Perl 5 programming language system itself. | ||
| 107 | |||
| 108 | =cut | ||