The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dancer2::Plugin::Auth::HTTP::Basic::DWIW - HTTP Basic authentication plugin for Dancer2 that does what I want.

VERSION

version 0.0901

SYNOPSIS

    package test;

    use Dancer2;
    use Dancer2::Plugin::Auth::HTTP::Basic::DWIW;

    http_basic_auth_handler check_login => sub {
        my ( $user, $pass ) = @_;

        # you probably want to check the user in a better way
        return $user eq 'test' && $pass eq 'bla';
    };

    http_basic_auth_handler no_auth => sub {
        template 'auth_error';
    };

    get '/' => http_basic_auth required => sub {
        my ( $user, $pass ) = http_basic_auth_login;

        return $user;
    };
    1;

DESCRIPTION

This plugin gives you the option to use HTTP Basic authentication with Dancer2.

You can set a handler to check the supplied credentials. If you don't set a handler, every username/password combination will work.

CAUTION

Don't ever use HTTP Basic authentication over clear-text connections! Always use HTTPS!

The only case were using HTTP is ok is while developing an application. Don't use HTTP because you think it is ok in corporate networks or something alike, you can always have bad bad people in your network..

CONFIGURATION

realm

The realm presented by browsers in the login dialog.

Defaults to "Please login".

OTHER

This is my first perl module published on CPAN. Please don't hurt me when it is bad and feel free to make suggestions or to fork it on GitHub.

BUGS

Please report any bugs or feature requests to littlefox at fsfe.org, or through the web interface at https://github.com/LittleFox94/Dancer2-Plugin-Auth-HTTP-Basic-DWIW/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

After installation you can find documentation for this module with the perldoc command:

    perldoc Dancer2::Plugin::Auth::HTTP::Basic::DWIW

AUTHOR

Mara Sophie Grosch (LittleFox) <littlefox@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by Mara Sophie Grosch (LittleFox).

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.