NAME
WWW::Suffit::AuthDB::Role::AAA - Suffit AuthDB methods for AAA
SYNOPSIS
use WWW::Suffit::AuthDB;
my $authdb = WWW::Suffit::AuthDB->with_roles('+AAA')->new( ... );
DESCRIPTION
The API provided by this module deals with access, authentication and authorization phases
METHODS
This class extends WWW::Suffit::AuthDB and implements the following new ones methods
access
$authdb->access(
controller => $self, # The Mojo controller object
username => "Bob",
cachekey => "d1b919c1",
base => "https://www.example.com",
method => "GET",
url => "https://www.example.com/foo/bar",
path => "/foo/bar",
remote_ip => "127.0.0.1",
routename => "root",
headers => {
Accept => "text/html,text/plain",
Connection => "keep-alive",
Host => "localhost:8695",
},
) or die $authdb->error;
...or short syntax:
$authdb->access(
c => $self, # The Mojo controller object
u => "Bob",
k => "d1b919c1",
b => "https://www.example.com",
m => "GET",
url => "https://www.example.com/foo/bar",
p => "/foo/bar",
i => "127.0.0.1",
r => "root",
h => {
Accept => "text/html,text/plain",
Connection => "keep-alive",
Host => "localhost:8695",
},
) or die $authdb->error;
This method performs access control
Check by routename:
<% if (has_access(path => url_for('settings')->to_string)) { %> ... <% } %>
<% if (has_access(route => 'settings') { %> ... <% } %>
authen
This method is deprecated! See "authn"
authn
$authdb->authn(
username => "username",
password => "password",
address => "127.0.0.1",
cachekey => "d1b919c1",
) or die $authdb->error;
...or short syntax:
$authdb->authn(
u => "username",
p => "password",
a => "127.0.0.1",
k => "d1b919c1",
) or die $authdb->error;
This method checks password by specified credential pair (username and password) and remote client IP address.
The method returns the User object or undef if errors occurred
authz
$authdb->authz(
username => "username",
scope => 0, # 0 - internal; 1 - external
cachekey => "d1b919c1",
) or die $authdb->error;
...or short syntax:
$authdb->authz(
u => "username",
s => 0, # 0 - internal; 1 - external
k => "d1b919c1",
) or die $authdb->error;
This method checks authorization status by specified username.
The scope argument can be false or true. false - determines the fact that internal authorization is being performed (on Suffit system); true - determines the fact that external authorization is being performed (on another sites)
The method returns the User object or undef if errors occurred
ERROR CODES
List of error codes describes in WWW::Suffit::AuthDB
HISTORY
See Changes
file
TO DO
See TODO
file
SEE ALSO
WWW::Suffit::AuthDB, Mojolicious, Role::Tiny
AUTHOR
Serż Minus (Sergey Lepenkov) https://www.serzik.com <abalama@cpan.org>
COPYRIGHT
Copyright (C) 1998-2025 D&D Corporation. All Rights Reserved
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See LICENSE
file and https://dev.perl.org/licenses/