-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
110 lines (84 loc) · 3.12 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
NAME
Catalyst::Authentication::Credential::Flickr - Flickr authentication for
Catalyst
SYNOPSIS
In MyApp.pm
use Catalyst qw/
Authentication
Session
Session::Store::FastMmap
Session::State::Cookie
/;
MyApp->config(
"Plugin::Authentication" => {
default_realm => "flickr",
realms => {
flickr => {
credential => {
class => "Flickr",
},
key => 'flickr-key-here',
secret => 'flickr-secret-here',
perms => 'read',
},
},
},
);
And then in your Controller:
sub login : Local {
my ($self, $c) = @_;
my $realm = $c->get_auth_realm('flickr');
$c->res->redirect( $realm->credential->authenticate_flickr_url($c) );
}
And finally the callback you specified in your API key request (e.g.
example.com/flickr/ ):
sub flickr : Local {
my ($self, $c) = @_;
$c->authenticate();
$c->res->redirect("/super/secret/member/area");
}
DESCRIPTION
This module handles Flickr API authentication in a Catalyst application.
When Catalyst::Plugin::Authentication 0.10 was released, the API had
changed, resulting in broken code when using
Catalyst::Plugin::Authentication::Credential::Flickr.
This module tries to follow the guidelines of the new API and deprecate
Catalyst::Plugin::Authentication::Credential::Flickr.
Code changes are needed, but are fairly minimal.
METHODS
As per guidelines of Catalyst::Plugin::Authentication, there are two
mandatory methods, "new" and "authenticate". Since this is not really
enough for the Flickr API, I've added one more (and an alias).
new()
Will not be called by you directly, but will use the configuration you
provide (see above). Mandatory parameters are "key", "secret" and
"perms". Please see Flickr::API for more details on them.
authenticate_flickr_url( $c )
This method will return the authentication URL. Bounce your users there
before calling the "authentication" method.
authenticate( )
Handles the authentication. Nothing more, nothing less. It returns a
Catalyst::Authentication::User::Hash with the following keys (all coming
straight from Flickr).
fullname
nsid
perms
token
username
AUTHOR
M. Blom <[email protected]> <http://menno.b10m.net/perl/>
COPYRIGHT
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included
with this module.
SEE ALSO
Catalyst::Plugin::Authentication, Flickr::API
BUGS
"Bugs? Impossible!". Please report bugs to
<http://rt.cpan.org/Ticket/Create.html?Queue=Catalyst-Authentication-Cre
dential-Flickr>
THANKS
Thanks go out Daisuke Murase for writing C::P::A::Credential::Flickr,
Ashley Pond for inspiration and help in C::A::Credential::OpenID, Cal
Henderson for Flickr::API.