Apache2-Controller
view release on metacpan or search on metacpan
lib/Apache2/Controller/Auth/OpenID.pm view on Meta::CPAN
# uri to your logout controller:
A2C_Auth_OpenID_Logout logout
# uri to your registration controller:
A2C_Auth_OpenID_Register register
# you might want to put this outside the protected area,
# i.e. /other/register - you can use leading '/' for absolute uri
# idle timeout in seconds, +2m, +3h, +4D, +6M, +7Y, or 'no timeout'
# default is 1 hour. a month is actually 30 days, a year 365.
A2C_Auth_OpenID_Timeout +1h
# name of the openid table in database:
A2C_Auth_OpenID_Table openid
# key of the username field in table:
A2C_Auth_OpenID_User_Field uname
# key of the openid url field in table:
A2C_Auth_OpenID_URL_Field openid_url
lib/Apache2/Controller/Auth/OpenID.pm view on Meta::CPAN
my $sess = $self->pnotes->{a2c}{session}
|| a2cx "No session object configured for handler";
DEBUG sub { "Entering, processing uri '$uri'.\nsession is:\n".Dump($sess) };
my $directives = $self->get_directives();
my %conf = (
$self->default_directives(),
( map {(lc($_) => $directives->{"A2C_Auth_OpenID_$_"})}
grep exists $directives->{"A2C_Auth_OpenID_$_"}, qw(
Login Logout Register Timeout
Table User_Field URL_Field DBI_Name
Trust_Root LWP_Class Allow_Login Consumer_Secret
NoPreserveParams
) ),
);
# make a lookup verification map of the internal uris
$conf{is_internal} = { map {($conf{$_} => 1)} qw( login logout register ) };
# slap in anything specified in the sub-hash of LWP class options
lib/Apache2/Controller/Directives.pm view on Meta::CPAN
args_how => Apache2::Const::TAKE1,
errmsg => 'example: A2C_Auth_OpenID_Logout /myapp/logout',
},
{
name => 'A2C_Auth_OpenID_Register',
req_override => Apache2::Const::OR_ALL,
args_how => Apache2::Const::TAKE1,
errmsg => 'example: A2C_Auth_OpenID_Register /myapp/register',
},
{
name => 'A2C_Auth_OpenID_Timeout',
req_override => Apache2::Const::OR_ALL,
args_how => Apache2::Const::TAKE1,
errmsg => 'example: A2C_Auth_OpenID_Timeout +1h',
},
{
name => 'A2C_Auth_OpenID_Table',
req_override => Apache2::Const::OR_ALL,
args_how => Apache2::Const::TAKE1,
errmsg => 'example: A2C_Auth_OpenID_Table openid',
},
{
name => 'A2C_Auth_OpenID_User_Field',
req_override => Apache2::Const::OR_ALL,
lib/Apache2/Controller/Directives.pm view on Meta::CPAN
=cut
sub A2C_Auth_OpenID_Register {
my ($self, $parms, $val) = @_;
$val = 'register' if !defined $val;
($val) = $val =~ m{ \A (.*) \z }mxs;
$val = $parms->path.'/'.$val if $val !~ m{ \A / }mxs;
$self->{A2C_Auth_OpenID_Register} = $val;
}
=head2 A2C_Auth_OpenID_Timeout
A2C_Auth_OpenID_Timeout +1h
Idle timeout in seconds, +2m, +3h, +4D, +6M, +7Y, or 'no timeout'.
Default is 1 hour. A month is actually 30 days, a year 365.
If you use 'no timeout' then logins will never expire.
This probably is not a good idea because OpenID url's can
be revoked, and because the login process can be a transparent
series of redirects if the user has something like
Verisign's SeatBelt plugin.
lib/Apache2/Controller/Directives.pm view on Meta::CPAN
my %time_multiplier = (
s => 1,
m => 60,
h => 60 * 60,
D => 60 * 60 * 24,
M => 60 * 60 * 24 * 30,
Y => 60 * 60 * 24 * 365,
);
sub A2C_Auth_OpenID_Timeout {
my ($self, $parms, $val) = @_;
$val ||= '+1h';
($val) = $val =~ m{ \A (.*) \z }mxs;
if ($val ne 'no timeout') {
my ($num, $period) = $val =~ m{ \A \+? (\d+) ([YMDhms]?) \z }mxs;
$period ||= 's';
croak("A2C_Auth_OpenID_Timeout invalid format")
if !$num || !exists $time_multiplier{$period};
$val = $num * $time_multiplier{$period};
}
$self->{A2C_Auth_OpenID_Timeout} = $val;
}
=head2 A2C_Auth_OpenID_Table
A2C_Auth_OpenID_Login openid
Name of the table in your connected database containing the
user name and OpenID url fields. Default == "openid".
=cut
lib/Apache2/Controller/Refcard.pm view on Meta::CPAN
401 AUTH_REQUIRED Unauthorized
401 HTTP_UNAUTHORIZED Unauthorized
402 HTTP_PAYMENT_REQUIRED Payment Required
403 FORBIDDEN Forbidden
403 HTTP_FORBIDDEN Forbidden
404 HTTP_NOT_FOUND Not Found
404 NOT_FOUND Not Found
405 HTTP_METHOD_NOT_ALLOWED Method Not Allowed
406 HTTP_NOT_ACCEPTABLE Not Acceptable
407 HTTP_PROXY_AUTHENTICATION_REQUIRED Proxy Authentication Required
408 HTTP_REQUEST_TIME_OUT Request Timeout
409 HTTP_CONFLICT Conflict
410 HTTP_GONE Gone
411 HTTP_LENGTH_REQUIRED Length Required
412 HTTP_PRECONDITION_FAILED Precondition Failed
413 HTTP_REQUEST_ENTITY_TOO_LARGE Request Entity Too Large
414 HTTP_REQUEST_URI_TOO_LARGE Request-URI Too Large
415 HTTP_UNSUPPORTED_MEDIA_TYPE Unsupported Media Type
416 HTTP_RANGE_NOT_SATISFIABLE Request Range Not Satisfiable
417 HTTP_EXPECTATION_FAILED Expectation Failed
500 HTTP_INTERNAL_SERVER_ERROR Internal Server Error
500 SERVER_ERROR Internal Server Error
501 HTTP_NOT_IMPLEMENTED Not Implemented
502 HTTP_BAD_GATEWAY Bad Gateway
503 HTTP_SERVICE_UNAVAILABLE Service Unavailable
504 HTTP_GATEWAY_TIME_OUT Gateway Timeout
506 HTTP_VARIANT_ALSO_VARIES Variant Also Negotiates
507 HTTP_INSUFFICIENT_STORAGE Insufficient Storage
510 HTTP_NOT_EXTENDED Not Extended
For reference, a utility script has been included in the build directory,
utils/apache2_http_response_reference_list.pl. This dumps the :common
and :http constants from Apache2::Const and lists their names alongside the
corresponding status_message() strings from HTTP::Status. This is the
resulting list of codes and corresponding HTTP::Status messages.
t/lib/TestApp/OpenID/C/Setup.pm view on Meta::CPAN
# don't delete the session id! oops.
delete $self->{session}{$_} for grep !m{ \A _ }mxs, keys %{$self->{session}};
$self->content_type('text/plain');
$self->print("Created Database Tables.");
return Apache2::Const::HTTP_OK;
}
# force a timeout of the openid session for testing purposes
sub force_timeout {
my ($self) = @_;
my $timeout = $self->get_directive('A2C_Auth_OpenID_Timeout') || 3600;
my $openid_sess = $self->{session}{a2c}{openid};
$openid_sess->{last_accessed_time} -= $timeout * 2
if defined $openid_sess->{last_accessed_time};
$self->content_type('text/plain');
$self->print("Forced session timeout.");
DEBUG "FORCE SESSION TIMEOUT, SESSION NOW:\n".Dump($self->{session});
return Apache2::Const::HTTP_OK;
}
1;
( run in 0.249 second using v1.01-cache-2.11-cpan-4d50c553e7e )