Ado

 view release on metacpan or  search on metacpan

etc/plugins/auth.conf  view on Meta::CPAN

#!/usr/bin/perl
use strict;
use warnings;
use utf8;

#$MOJO_HOME/etc/plugins/auth.conf
#Default configuration for Ado::Plugin::Auth

{
    #Methods which will be displayed in the "Sign in" menu.
    #must exactly match keys in the providers hash reference below.
    # Add OAuth2 providers to ado.development.conf.
    auth_methods => ['ado'],

    #Configurations for methods not provided by Mojolicious::Plugin::OAuth2
    providers => {

        #Add the rest of the needed configuration options
        # to auth.development.conf or auth.production.conf only
        # because this is highly sensitive and application specific information.
        # Get the credentials from
        # https://console.developers.google.com/project/yourproject/apiui/credential
        # See https://developers.google.com/accounts/docs/OAuth2UserAgent
        # https://developers.google.com/oauthplayground/
        #Example for google:
        # google =>{
        #     #client_id
        #     key =>'123456654321abcd.apps.googleusercontent.com',
        #     secret =>'Y0uRS3cretHEre',
        #     scope=>'profile email',
        #     info_url => 'https://www.googleapis.com/userinfo/v2/me',
        #     },
    },

    #Add your routes definitions here.
    routes => [

        #the login form and authentication
        {   route => '/login/:auth_method',
            via   => ['GET', 'POST'],
            to    => {
                auth_method => 'ado',
                cb          => \&Ado::Plugin::Auth::login
            },
            description => 'GET: Renders a login form when :auth_method is "ado".'
              . ' or authenticates a user when :auth_method is an OAuth2 provider.'
              . $/
              . 'POST: Authenticates a user.',
        },

        {   route => '/authorize/:auth_method',
            via   => ['GET', 'POST'],
            to    => {
                auth_method => 'google',
                cb          => \&Ado::Plugin::Auth::authorize
            },
        },

        {   route => '/logout',
            to    => {cb => \&Ado::Plugin::Auth::logout}
        },
        {   route => '/test/authenticateduser',
            over  => {authenticated => 1},
            to    => 'test#authenticateduser'
        },

    ],
};

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.398 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )