Skip to content
Browse files

OpenID authentication

  • Loading branch information...
1 parent 3c72424 commit 7d6068a4653d1b9a83f15c8e816d5e91c73ce9c4 @DimaD DimaD committed Sep 21, 2008
Showing with 62 additions and 3 deletions.
  1. +16 −3 lib/Perlflow.pm
  2. +32 −0 lib/perlflow/Controller/User.pm
  3. +9 −0 perlflow.yml
  4. +1 −0 tpl/index.tt
  5. +4 −0 tpl/user/login.tt
View
19 lib/Perlflow.pm
@@ -16,9 +16,22 @@ use Catalyst::Runtime '5.70';
# directory
use parent qw/Catalyst/;
-use Catalyst qw/-Debug
- ConfigLoader
- Static::Simple/;
+use Catalyst qw/
+ -Debug
+
+ ConfigLoader
+ Static::Simple
+
+ Unicode
+ Static::Simple
+
+ Authentication
+ Authentication::Credential::OpenID
+
+ Session
+ Session::Store::FastMmap
+ Session::State::Cookie
+/;
our $VERSION = '0.01';
# Configure the application.
View
32 lib/perlflow/Controller/User.pm
@@ -0,0 +1,32 @@
+package Perlflow::Controller::User;
+
+use strict;
+use warnings;
+use parent 'Catalyst::Controller';
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+
+}
+
+sub login : Local {
+ my ( $self, $c ) = @_;
+
+ if ($c->authenticate_openid) {
+ return $c->res->redirect( $c->uri_for('/') );
+ }
+}
+
+=head1 AUTHOR
+
+Dmitriy Dzema
+
+=head1 LICENSE
+
+This library is free software, you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
+
+1;
View
9 perlflow.yml
@@ -13,3 +13,12 @@ Model::DB:
name_sep: '.'
session:
expires: 2592000
+
+Plugin::Authentication:
+ default_realm: openid
+ realms:
+ openid:
+ credential:
+ class: OpenID
+ store:
+ class: Null
View
1 tpl/index.tt
@@ -14,6 +14,7 @@
<div class="container header">
<h1>PerlFlows</h1>
+ [% IF C.user %][% C.user.display %][% ELSE %]<a href="/user/login">Войдите через OpenID</a>[% END %]
</div>
<div class="container_12">
<div class="grid_8">
View
4 tpl/user/login.tt
@@ -0,0 +1,4 @@
+<form action="[% c.uri_for('/signin_openid') %]" method="GET">
+ <input type="text" name="openid_url" class="openid" />
+ <input type="submit" value="Sign in with OpenID" />
+</form>

0 comments on commit 7d6068a

Please sign in to comment.
Something went wrong with that request. Please try again.