{"id":16669423,"url":"https://github.com/bigpresh/dancer-plugin-auth-extensible","last_synced_at":"2026-02-28T10:31:13.878Z","repository":{"id":4539364,"uuid":"5679793","full_name":"bigpresh/Dancer-Plugin-Auth-Extensible","owner":"bigpresh","description":"Authentication framework for Dancer-based web applications","archived":false,"fork":false,"pushed_at":"2016-09-06T14:06:09.000Z","size":244,"stargazers_count":22,"open_issues_count":4,"forks_count":18,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-06T17:05:40.604Z","etag":null,"topics":["authentication","authorization","dancer","hacktoberfest","perl"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigpresh.png","metadata":{"files":{"readme":"README","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-04T23:00:11.000Z","updated_at":"2020-10-15T22:10:49.000Z","dependencies_parsed_at":"2022-09-18T20:33:41.722Z","dependency_job_id":null,"html_url":"https://github.com/bigpresh/Dancer-Plugin-Auth-Extensible","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpresh%2FDancer-Plugin-Auth-Extensible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpresh%2FDancer-Plugin-Auth-Extensible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpresh%2FDancer-Plugin-Auth-Extensible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigpresh%2FDancer-Plugin-Auth-Extensible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigpresh","download_url":"https://codeload.github.com/bigpresh/Dancer-Plugin-Auth-Extensible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248098162,"owners_count":21047390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","authorization","dancer","hacktoberfest","perl"],"created_at":"2024-10-12T11:32:36.202Z","updated_at":"2026-02-28T10:31:13.835Z","avatar_url":"https://github.com/bigpresh.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n    Dancer::Plugin::Auth::Extensible - extensible authentication framework\n    for Dancer apps\n\nDESCRIPTION\n    A user authentication and authorisation framework plugin for Dancer\n    apps.\n\n    Makes it easy to require a user to be logged in to access certain\n    routes, provides role-based access control, and supports various\n    authentication methods/sources (config file, database, Unix system\n    users, etc).\n\n    Designed to support multiple authentication realms and to be as\n    extensible as possible, and to make secure password handling easy. The\n    base class for auth providers makes handling `RFC2307'-style hashed\n    passwords really simple, so you have no excuse for storing plain-text\n    passwords. A simple script to generate RFC2307-style hashed passwords is\n    included (it now defaults to SHA-512), or you can use Crypt::SaltedHash\n    yourself to do so (but choose a secure algorhytm), or use the\n    `slappasswd' utility if you have it installed.\n\nSYNOPSIS\n    Configure the plugin to use the authentication provider class you wish\n    to use:\n\n      plugins:\n            Auth::Extensible:\n                realms:\n                    users:\n                        provider: Example\n                        ....\n\n    The configuration you provide will depend on the authentication provider\n    module in use. For a simple example, see\n    Dancer::Plugin::Auth::Extensible::Provider::Config.\n\n    Define that a user must be logged in and have the proper permissions to\n    access a route:\n\n        get '/secret' =\u003e require_role Confidant =\u003e sub { tell_secrets(); };\n\n    Define that a user must be logged in to access a route - and find out\n    who is logged in with the `logged_in_user' keyword:\n\n        get '/users' =\u003e require_login sub {\n            my $user = logged_in_user;\n            return \"Hi there, $user-\u003e{username}\";\n        };\n\nAUTHENTICATION PROVIDERS\n    For flexibility, this authentication framework uses simple\n    authentication provider classes, which implement a simple interface and\n    do whatever is required to authenticate a user against the chosen source\n    of authentication.\n\n    For an example of how simple provider classes are, so you can build your\n    own if required or just try out this authentication framework plugin\n    easily, see Dancer::Plugin::Auth::Extensible::Provider::Example.\n\n    This framework supplies the following providers out-of-the-box:\n\n    Dancer::Plugin::Auth::Extensible::Provider::Unix\n        Authenticates users using system accounts on Linux/Unix type boxes\n\n    Dancer::Plugin::Auth::Extensible::Provider::Database\n        Authenticates users stored in a database table\n\n    Dancer::Plugin::Auth::Extensible::Provider::Config\n        Authenticates users stored in the app's config\n\n    Need to write your own? Just subclass\n    Dancer::Plugin::Auth::Extensible::Provider::Base and implement the\n    required methods, and you're good to go!\n\nCONTROLLING ACCESS TO ROUTES\n    Keywords are provided to check if a user is logged in / has appropriate\n    roles.\n\n    require_login - require the user to be logged in\n            get '/dashboard' =\u003e require_login sub { .... };\n\n        If the user is not logged in, they will be redirected to the login\n        page URL to log in. The default URL is `/login' - this may be\n        changed with the `login_page' option.\n\n    require_role - require the user to have a specified role\n            get '/beer' =\u003e require_role BeerDrinker =\u003e sub { ... };\n\n        Requires that the user be logged in as a user who has the specified\n        role. If the user is not logged in, they will be redirected to the\n        login page URL. If they are logged in, but do not have the required\n        role, they will be redirected to the access denied URL.\n\n    require_any_roles - require the user to have one of a list of roles\n            get '/drink' =\u003e require_any_role [qw(BeerDrinker VodaDrinker)] =\u003e sub {\n                ...\n            };\n\n        Requires that the user be logged in as a user who has any one (or\n        more) of the roles listed. If the user is not logged in, they will\n        be redirected to the login page URL. If they are logged in, but do\n        not have any of the specified roles, they will be redirected to the\n        access denied URL.\n\n    require_all_roles - require the user to have all roles listed\n            get '/foo' =\u003e require_all_roles [qw(Foo Bar)] =\u003e sub { ... };\n\n        Requires that the user be logged in as a user who has all of the\n        roles listed. If the user is not logged in, they will be redirected\n        to the login page URL. If they are logged in but do not have all of\n        the specified roles, they will be redirected to the access denied\n        URL.\n\n  Replacing the Default ` /login ' and ` /login/denied ' Routes\n    By default, the plugin adds a route to present a simple login form at\n    that URL. If you would rather add your own, set the `no_default_pages'\n    setting to a true value, and define your own route which responds to\n    `/login' with a login page. Alternatively you can let DPAE add the\n    routes and handle the status codes, etc. and simply define the setting\n    `login_page_handler' and/or `permission_denied_page_handler' with the\n    name of a subroutine to be called to handle the route. Note that it must\n    be a fully qualified sub. E.g.\n\n        plugins:\n          Auth::Extensible:\n            login_page_handler: 'My::App:login_page_handler'\n            permission_denied_page_handler: 'My::App:permission_denied_page_handler'\n\n    Then in your code you might simply use a template:\n\n        sub permission_denied_page_handler {\n            template 'account/login';\n        }\n\n    If the user is logged in, but tries to access a route which requires a\n    specific role they don't have, they will be redirected to the\n    \"permission denied\" page URL, which defaults to `/login/denied' but may\n    be changed using the `denied_page' option.\n\n    Again, by default a route is added to respond to that URL with a default\n    page; again, you can disable this by setting `no_default_pages' and\n    creating your own.\n\n    This would still leave the routes `post '/login'' and `any '/logout''\n    routes in place. To disable them too, set the option `no_login_handler'\n    to a true value. In this case, these routes should be defined by the\n    user, and should do at least the following:\n\n        post '/login' =\u003e sub {\n            my ($success, $realm) = authenticate_user(\n                params-\u003e{username}, params-\u003e{password}\n            );\n            if ($success) {\n                session logged_in_user =\u003e params-\u003e{username};\n                session logged_in_user_realm =\u003e $realm;\n                # other code here\n            } else {\n                # authentication failed\n            }\n        };\n    \n        any '/logout' =\u003e sub {\n            session-\u003edestroy;\n        };\n    \n    If you want to use the default `post '/login'' and `any '/logout''\n    routes you can configure them. See below.\n\n  Keywords\n    require_login\n        Used to wrap a route which requires a user to be logged in order to\n        access it.\n\n            get '/secret' =\u003e require_login sub { .... };\n\n    require_role\n        Used to wrap a route which requires a user to be logged in as a user\n        with the specified role in order to access it.\n\n            get '/beer' =\u003e require_role BeerDrinker =\u003e sub { ... };\n\n        You can also provide a regular expression, if you need to match the\n        role using a regex - for example:\n\n            get '/beer' =\u003e require_role qr/Drinker$/ =\u003e sub { ... };\n\n    require_any_role\n        Used to wrap a route which requires a user to be logged in as a user\n        with any one (or more) of the specified roles in order to access it.\n\n            get '/foo' =\u003e require_any_role [qw(Foo Bar)] =\u003e sub { ... };\n\n    require_all_roles\n        Used to wrap a route which requires a user to be logged in as a user\n        with all of the roles listed in order to access it.\n\n            get '/foo' =\u003e require_all_roles [qw(Foo Bar)] =\u003e sub { ... };\n\n    logged_in_user\n        Returns a hashref of details of the currently logged-in user, if\n        there is one.\n\n        The details you get back will depend upon the authentication\n        provider in use.\n\n    user_has_role\n        Check if a user has the role named.\n\n        By default, the currently-logged-in user will be checked, so you\n        need only name the role you're looking for:\n\n            if (user_has_role('BeerDrinker')) { pour_beer(); }\n\n        You can also provide the username to check;\n\n            if (user_has_role($user, $role)) { .... }\n\n    user_roles\n        Returns a list of the roles of a user.\n\n        By default, roles for the currently-logged-in user will be checked;\n        alternatively, you may supply a username to check.\n\n        Returns a list or arrayref depending on context.\n\n    authenticate_user\n        Usually you'll want to let the built-in login handling code deal\n        with authenticating users, but in case you need to do it yourself,\n        this keyword accepts a username and password, and optionally a\n        specific realm, and checks whether the username and password are\n        valid.\n\n        For example:\n\n            if (authenticate_user($username, $password)) {\n                ...\n            }\n\n        If you are using multiple authentication realms, by default each\n        realm will be consulted in turn. If you only wish to check one of\n        them (for instance, you're authenticating an admin user, and there's\n        only one realm which applies to them), you can supply the realm as\n        an optional third parameter.\n\n        In boolean context, returns simply true or false; in list context,\n        returns `($success, $realm)'.\n\n  SAMPLE CONFIGURATION\n    In your application's configuration file:\n\n        session: simple\n        plugins:\n            Auth::Extensible:\n                # Set to 1 if you want to disable the use of roles (0 is default)\n                disable_roles: 0\n                # After /login: If no return_url is given: land here ('/' is default)\n                user_home_page: '/user'\n                # After /logout: If no return_url is given: land here (no default)\n                exit_page: '/'\n            \n                # List each authentication realm, with the provider to use and the\n                # provider-specific settings (see the documentation for the provider\n                # you wish to use)\n                realms:\n                    realm_one:\n                        provider: Database\n                            db_connection_name: 'foo'\n\n    Please note that you must have a session provider configured. The\n    authentication framework requires sessions in order to track information\n    about the currently logged in user. Please see Dancer::Session for\n    information on how to configure session management within your\n    application.\n\nAUTHOR\n    David Precious, `\u003cdavidp at preshweb.co.uk\u003e'\n\nBUGS / FEATURE REQUESTS\n    This is an early version; there may still be bugs present or features\n    missing.\n\n    This is developed on GitHub - please feel free to raise issues or pull\n    requests against the repo at:\n    https://github.com/bigpresh/Dancer-Plugin-Auth-Extensible\n\nACKNOWLEDGEMENTS\n    Valuable feedback on the early design of this module came from many\n    people, including Matt S Trout (mst), David Golden (xdg), Damien\n    Krotkine (dams), Daniel Perrett, and others.\n\n    Configurable login/logout URLs added by Rene (hertell)\n\n    Regex support for require_role by chenryn\n\n    Support for user_roles looking in other realms by Colin Ewen (casao)\n\n    Config options for default login/logout handlers by Henk van Oers\n    (hvoers)\n\nLICENSE AND COPYRIGHT\n    Copyright 2012-16 David Precious.\n\n    This program is free software; you can redistribute it and/or modify it\n    under the terms of either: the GNU General Public License as published\n    by the Free Software Foundation; or the Artistic License.\n\n    See http://dev.perl.org/licenses/ for more information.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpresh%2Fdancer-plugin-auth-extensible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigpresh%2Fdancer-plugin-auth-extensible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigpresh%2Fdancer-plugin-auth-extensible/lists"}