App-Context
view release on metacpan or search on metacpan
need to be turned on or off, it would be easier to simply use the
following.
eval "use $class;"
The first AOP
feature planned is the printing of arguments on entry to a method and
the printing of arguments and return values on exit of a a method.
This is useful
for debugging and the generation of object-message traces to validate
or document the flow of messages through the system.
Detailed Conditions:
* use(001) class does not exist: throw a App::Exception
* use(002) class never used before: should succeed
* use(003) class used before: should succeed
* use(004) can use class after: should succeed
=cut
lib/App/Authentication.pm view on Meta::CPAN
App::Authentication - Interface for authentication and authorization
=head1 SYNOPSIS
use App;
$context = App->context();
$authentication = $context->service("Authentication"); # or ...
$authentication = $context->authentication();
if ($authentication->validate_password($username, $password)) {
...
}
=head1 DESCRIPTION
An Authentication service is a means by which a user may be authenticated.
=cut
#############################################################################
lib/App/Authentication.pm view on Meta::CPAN
#############################################################################
# PUBLIC METHODS
#############################################################################
=head1 Public Methods:
=cut
#############################################################################
# validate_password()
#############################################################################
=head2 validate_password()
* Signature: $username = $auth->validate_password();
* Param: void
* Return: $username string
* Throws: App::Exception::Authentication
* Since: 0.01
Sample Usage:
$username = $auth->validate_password();
=cut
sub validate_password {
my ($self, $username, $password) = @_;
return(1);
}
#############################################################################
# Method: service_type()
#############################################################################
=head2 service_type()
lib/App/Authentication/Htpasswd.pm view on Meta::CPAN
App::Authentication::Htpasswd - Interface for authentication using an htpasswd file
=head1 SYNOPSIS
use App;
$context = App->context();
$authentication = $context->service("Authentication"); # or ...
$authentication = $context->authentication();
if ($authentication->validate_password($username, $password)) {
...
}
=head1 DESCRIPTION
An App::Authentication::Htpasswd service is a means by which a user may be authenticated
using an htpasswd file.
=cut
#############################################################################
# PUBLIC METHODS
#############################################################################
=head1 Public Methods:
=cut
#############################################################################
# validate_password()
#############################################################################
=head2 validate_password()
* Signature: $username = $auth->validate_password();
* Param: void
* Return: $username string
* Throws: App::Exception::Authentication
* Since: 0.01
Sample Usage:
$username = $auth->validate_password();
=cut
sub validate_password {
&App::sub_entry if ($App::trace);
my ($self, $username, $password) = @_;
my $valid = 0;
my $context = $self->{context};
my $htpasswd_file = $context->get_option("htpasswd_file");
if (-e $htpasswd_file) {
my ($uname, $pword);
if (open(PFILE, "< $htpasswd_file")) {
lib/App/Conf.pod view on Meta::CPAN
# two levels under the hash ref as shown.
$config->{Conf} # config settings for all Conf services
$config->{Conf}{default} # config settings for the default Conf service
$config->{Security} # config settings for all Security services
$config->{Security}{default} # config settings for the default Security service
$config->{TemplateEngine}{tt} # config settings for the Template service named "tt"
# The default driver (if "configClass" not supplied) reads in a Perl
# data structure from the file. Alternate drivers can read a Storable,
# unvalidated XML, DTD-validated XML, RDF-validated XML, or any other
# file format or data source anyone cares to write a driver for.
$conf = {
'Standard' => {
'Log-Dispatch' => {
'logdir' => '/var/p5ee',
}
},
'Authen' => {
'passwd' => '/etc/passwd',
lib/App/Conf.pod view on Meta::CPAN
=head2 Requirements
The following are enumerated requirements for the Conf Class Group.
It forms a high-level feature list.
The requirements which have been satisfied
(or features implemented) have an "x" by them, whereas the requirements
which have yet-to-be satisfied have an "o" by them.
x Read from many different file formats including...
x Pure perl (Data::Dumper format)
o Unvalidated XML
o Validated XML
o Validated RDF
o Windows ini file
o Java-style properties
o customized
x Support fetching configuration from completely customized source
o Allow config to be split into multiple files/sources
o Load various portions of the config tree on-demand
o Overlay configs on top of each other
o Splice/graft config trees onto each other
lib/App/Conf/File.pod view on Meta::CPAN
# two levels under the hash ref as shown.
$config->{Conf} # config settings for all Conf services
$config->{Conf}{default} # config settings for the default Conf service
$config->{Security} # config settings for all Security services
$config->{Security}{default} # config settings for the default Security service
$config->{Template}{tt} # config settings for the Template service named "tt"
# The default driver (if "configClass" not supplied) reads in a Perl
# data structure from the file. Alternate drivers can read a Storable,
# unvalidated XML, DTD-validated XML, RDF-validated XML, or any other
# file format or data source anyone cares to write a driver for.
$conf = {
'Standard' => {
'Log-Dispatch' => {
'logdir' => '/var/p5ee',
}
},
'Authen' => {
'passwd' => '/etc/passwd',
lib/App/Context/HTTP.pm view on Meta::CPAN
my $options = $self->{options};
my ($effective_user);
my $authenticated = 0;
if ($options->{app_auth_required}) {
# Bypass Basic Authentication, /../..?u=username&p=password
my $password = $self->so_get("default","p");
$user = $self->so_get("default","u");
if (defined $password && defined $user) {
my $authentication = $self->authentication();
if ( $authentication->validate_password($user, $password) ) {
$authenticated = 1;
$effective_user = $self->so_get("default","eu");
}
}
}
else {
$user = $self->request()->user();
my $p_pass = $self->so_get("default","p");
my $u_user = $self->so_get("default","u");
if (defined $p_pass && defined $u_user) {
my $authentication = $self->authentication();
if ( $authentication->validate_password($u_user, $p_pass) ) {
$authenticated = 1;
$user = $self->so_get("default","u");
$effective_user = $self->so_get("default","u");
}
else {
$user = 'guest';
$effective_user = 'guest';
}
}
lib/App/Serializer/Xml.pm view on Meta::CPAN
$xml = $serializer->serialize($data);
$data = $serializer->deserialize($xml);
print $serializer->dump($data), "\n";
=head1 DESCRIPTION
A Serializer allows you to serialize a structure of data
of arbitrary depth to a scalar and deserialize it back to the
structure.
The Xml serializer uses non-validated XML as the serialized
form of the data. It uses the XML::Simple class to perform
the deserialization and serialization.
=cut
#############################################################################
# CLASS
#############################################################################
=head1 Class: App::Serializer::Xml
lib/App/SessionObject.pm view on Meta::CPAN
sub fget_value {
&App::sub_entry if ($App::trace);
my ($self, $format) = @_;
$format = $self->get("format") if (!defined $format);
my ($value);
if (! defined $format) {
$value = $self->get_value("");
}
else {
my $type = $self->get("validate");
$value = $self->get_value("");
if ($type) {
$value = App::SessionObject->format($value, $type, $format);
}
}
&App::sub_exit($value) if ($App::trace);
return($value);
}
#############################################################################
lib/App/faq.pod view on Meta::CPAN
of each of the App-Context Services, making for an almost limitless array
of possible combinations. (Hopefully, favorites will emerge.)
The Context is a Core Service, like Session and Config.
(A Core Service is one that is not derived from App::Service
but maintains the concept of "a pluggable implementation of an
abstract service".) An examination of the App::Context
documentation will show that there are many Contexts from which
the implementer may choose to deploy the software, and the software
could reasonably run on all of them. The fact that (the envisioned)
App::Context::Modperl2 depends on 5.6.0 does not invalidate
the fact that the App-Context depends only on 5.5.3. Implementers who
choose to deploy with Services that have higher Perl version
dependencies must of course satisfy those dependencies.
The important thing to realize is that there is some combination of
implementations of Services which will run on 5.5.3. Thus, the
implementer who is stuck with 5.5.3 on a platform does indeed have a
set of possible combinations of Services which will work.
The dependency on Perl version is not the only issue like this.
( run in 0.511 second using v1.01-cache-2.11-cpan-a5abf4f5562 )