NAME
Authen::Pluggable::JSON - Authentication via external json
VERSION
version 0.03
SYNOPSIS
use
Authen::Pluggable;
my
$auth
= Authen::Pluggable->new();
$auth
->provider(
'JSON'
)->cfg({
url
=> ...,
query_builder
=> ...,
res_builder
=> ...,
});
my
$user_info
=
$auth
->authen(
$username
,
$password
) ||
die
"Login failed"
;
DESCRIPTION
Authen::Pluggable::JSON is a Authen::Pluggable plugin to authenticate users via JSON calls. You can personalize url, query parameters and returned JSON via configuration.
METHODS
cfg
This method takes a hash of parameters. The following options are valid:
- url
-
Url to JSON service. Default: a Mojo::URL istance to
http://127.0.0.1:3000/api/auth
- query_builder
-
A subroutine ref for appending query string to url. The sub is called like this:
$qb
->(
$url
,
$username
,
$password
);
Default appends
user=$username&pass=$password
to url. - res_builder
-
A subroutine ref for altering JSON structure returned by remote service to be compliance with Authen::Pluggable structure. The sub is called like this:
$rb
->(
$json
);
Default: return JSON structure returned by remote service as is or undef if remote service return
{}
.
BUGS/CONTRIBUTING
Please report any bugs through the web interface at https://github.com/EmilianoBruni/authen-pluggable/issues
If you want to contribute changes or otherwise involve yourself in development, feel free to fork the Git repository from https://github.com/EmilianoBruni/authen-pluggable/.
SUPPORT
You can find this documentation with the perldoc command too.
perldoc Authen::Pluggable::JSON
AUTHOR
Emiliano Bruni <info@ebruni.it>
COPYRIGHT AND LICENSE
This software is copyright (c) 2022 by Emiliano Bruni.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.