����Web���ץ�Ǥ��ꤿ���ʡ��Ȥ�������Catalyst�Ǥ��äĤ�ǧ�ڽ�������ΤϾ������ݡ�
�����ǡ�Catalyst�Ǻ�ή�Ԥ�(?)���ϤƤ�ǧ����Ȥ�����Υץ饰�����񤤤Ƥߤޤ�������Ȥ�Hatena::API::Auth��ñ�˻ȤäƤߤ�������
��Catalyst::Plugin::Authentication::Credential::HatenaAuth
�����Ȥ��Ȥ���ʴ����˽񤱤�褦�ˤʤ�ޤ���
use Catalyst qw/Authentication::Credential::HatenaAuth/; MyApp->config->{authentication}{hatenaauth} = { secret => 'xxxxxxxxx', api_key => 'xxxxxxxxxxxxxxxxxxxx', }; __PACKAGE__->setup; sub default : Private { my ( $self, $c ) = @_; $c->authenticate_hatena; $c->res->redirect('/') if $c->req->param('cert'); if( $c->req->cookies->{hatenaauth} ){ my %data = $c->req->cookies->{hatenaauth}->value; $c->stash->{username} = $data{name}; $c->stash->{image_url} = $data{image_url}; $c->stash->{thumbnail_url} = $data{thumbnail_url}; } } sub login : Local { my ( $self, $c ) = @_; $c->res->redirect( $c->config->{hatena_api}->uri_to_login ); }
�ʲ�������Ȥ�����
�ϤƤ�ǧ�ڤ�ɬ�פʤΤ���̩����API�����ʤΤǡ�config��YAML�ե�����Τɤ��餫�˻��ꤷ�Ƥ����ޤ���
# config�˽񤯾��
MyApp->config->{authentication}{hatenaauth} = { secret => 'xxxxxxxxx', api_key => 'xxxxxxxxxxxxxxxxxxxx', };
# myapp.yml�˽񤯾��
authentication: hatenaauth: secret: xxxxxxxxx api_key: xxxxxxxxxxxxxxxxxxxx
Cookie�˳�Ǽ���줿�ǡ����μ������ȡ��ϤƤ�ǧ��API�����ǧ�ڷ�̼������(������Хå�URL)��������Ǥϥȥåץڡ�����ξ����äƤ��ޤ���
cert�դ���URL�ǡֹ����ץܥ���򲡤����ȥ��顼�ˤʤ�Τǡ��ϤƤʤ�ǧ�ڷ�̤�����(cert������Ȥ�)�ϥ�����쥯�Ȥ��Ƥ��ޤ���
sub default : Private { my ( $self, $c ) = @_; $c->authenticate_hatena; # �����callback URL�˽񤯡� $c->res->redirect('/') if $c->req->param('cert'); # if( $c->req->cookies->{hatenaauth} ){ my %data = $c->req->cookies->{hatenaauth}->value; $c->stash->{username} = $data{name}; $c->stash->{image_url} = $data{image_url}; $c->stash->{thumbnail_url} = $data{thumbnail_url}; } }
http://example.com/login���������URL�Ȥ��롣
sub login : Local { my ( $self, $c ) = @_; $c->res->redirect( $c->config->{hatena_api}->uri_to_login ); }
���TT��Ŭ����ʬ�����Ƥ�����С���������Ѥߤξ��ϥ桼�������ɽ�����������Ǥʤ����ˤϥ�������URL��ɽ������Ȥ������Ȥ��Ǥ��ޤ���
�ȡ������ǽñ¤¤¤Æ¤ß¤Þ¤ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Ì¤ï¿½ï¿½ï¿½ï¿½Æ¤ï¿½ï¿½ï¿½Ê¤Î¤Ë°ï¿½Ì£ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Î¤ï¿½ï¿½É¤ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Î¥â¥¸ï¿½å¡¼ï¿½ï¿½ï¿½ñ¤¯¤Î¤Ï½ï¿½ï¿½Æ¤Ê¤Î¤Ç¸ï¿½ï¿½ï¿½ï¿½ã¤¤ï¿½Î¤ï¿½ï¿½È¤ò¤·¤Æ¤ï¿½ï¿½ï¿½Î¤Ç¤Ï¤Ê¤ï¿½ï¿½ï¿½ï¿½È»×¤ï¿½ï¿½Æ»ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½Þ¤ï¿½ï¿½ó¡£¤Ê¤ó¤«¤ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½ï¿½è¤¦ï¿½Êµï¿½ï¿½ï¿½(��)�������ʤ�Cookie�ˤ֤�����Ȥ����Τ�ɤ��ʤΤ�顣��ꤢ����������Â�Ǥ����ۤ�TypeKey�Τ���Υѥ���Ǥ�����
�����Ѥʥȥ��ʤɤ���Ф���Ŧ����������й����Ǥ����Ȥ����������Ԥ������������κ�äƤ���ʤ����ʤ���
����
http://www.tcool.org/catalyst/WritingPlugins.html
http://qootas.org/blog/archives/2005/06/catalyst_authen.html
http://blog.nomadscafe.jp/archives/000540.html
http://blog.nomadscafe.jp/archives/000501.html
http://d.hatena.ne.jp/hyuki/20060424