View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Léon Brocard > Catalyst-Plugin-SimpleAuth-0.33 > Catalyst::Plugin::SimpleAuth



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.33   Source  


Catalyst::Plugin::SimpleAuth - Simple authentication for Catalyst


  # in your Catalyst application:
  use Catalyst qw(SimpleAuth);
      simpleauth => { class => 'Users' },
  # in your sign up code
  unless( $c->sign_up(
            {   username => $email,
                password => $password,
        ) ) {
        # sign up failed, user exists
  my $user = $c->user;

  # in your sign in code
  my $user = $c->user; 
  if ($c->sign_in(
          {   username => $email,
              password => $password,
      my $user = $c->user;
  } else {
      # sign in failed

  # in your sign out code



This module is a replacement module for Catalyst::Authentication::* which does one thing and does it well. This module assumes that you have a model for the users you wish to authenticate - this will typically be a DBIx::Class module.

You set the name of the model to authenticate in the configuration as above. 'sign_up' creates the instance for you. 'sign_in' signs a person in, 'sign_out' signs a person out. You can access the user object either as $c->user in the code or as the 'user' variable in the stash.

This module saves SHA1 digests of the passwords instead of the password.

The model will generally have a database structure along the lines of:

  CREATE TABLE `users` (
    `username` text NOT NULL,
    `password` char(40) NOT NULL,
    `first_name` text,
    `last_name` text

Note that the password will be 40 characters long.

This module requires either Catalyst::Plugin::Session or Catalyst::Plugin::CookiedSession.


Leon Brocard <>.


Copyright (C) 2008-9, Leon Brocard


This module is free software; you can redistribute it or modify it under the same terms as Perl itself.

syntax highlighting: