Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
Apache2::AuthCookie::BUser3Contributed Perl DocumeApache2::AuthCookie::Base(3)

       Apache2::AuthCookie::Base - Common Methods Shared by Apache2 and
       Apache2_4 AuthCookie Subclasses.

       version 3.26

       This module contains common code	shared by AuthCookie for Apache	2.x
       and Apache 2.4.

   authenticate($r): int
       This method is one you'll use in	a server config	file (httpd.conf,
       .htaccess, ...) as a PerlAuthenHandler.	If the user provided a session
       key in a	cookie,	the "authen_ses_key()" method will get called to check
       whether the key is valid.  If not, or if	there is no key	provided, we
       redirect	to the login form.

   cookie_name($r): string
       Return the name of the auth cookie for this request.  This is either
       "${auth_name}CookieName", or AuthCookie's self generated	name.

   cookie_string(%args): string
       Generate	a cookie string. %args are:

       o   request

	   The Apache request object

       o   key

	   The Cookie name

       o   value

	   the Cookie value

       o   expires (optional)

	   When	the cookie expires. See	"expires()" in
	   Apache::AuthCookie::Util.  Uses "${auth_name}Expires" if not	giv

       All other cookie	settings come from "PerlSetVar"	settings.

   decoded_requires($r): arrayref
       This method returns the "$r->requires" array, with the "requirement"
       values decoded if "${auth_name}RequiresEncoding"	is in effect for this

   decoded_user($r): string
       If you have set ${auth_name}Encoding, then this will return the decoded
       value of	"$r->user".

   encoding($r): string
       Return the ${auth_name}Encoding setting that is in effect for this

   escape_uri($r, $value): string
       Escape the given	string so it is	suitable to be used in a URL.

   get_cookie_path($r):	string
       Returns the value of "PerlSetVar	${auth_name}Path".

   handle_cache($r): void
       If "${auth_name}Cache" is defined, this sets up the response so that
       the client will not cache the result.  This sents "no_cache" in the
       apache request object and sends the appropriate headers so that the
       client will not cache the response.

   key($r): string
       This method will	return the current session key,	if any.	 This can be
       handy inside a method that implements a "require" directive check (like
       the "species" method discussed above) if	you put	any extra information
       like clearances or whatever into	the session key.

   login($r): int
       This method handles the submission of the login form.  It will call the
       "authen_cred()" method, passing it $r and all the submitted data	with
       names like "credential_#", where	# is a number.	These will be passed
       in a simple array, so the prototype is "$self->authen_cred($r,
       @credentials)".	After calling "authen_cred()", we set the user's
       cookie and redirect to the URL contained	in the "destination" submitted
       form field.

   login_form($r): int
       This method is responsible for displaying the login form. The default
       implementation will make	an internal redirect and display the URL you
       specified with the "PerlSetVar WhatEverLoginScript" configuration
       directive. You can overwrite this method	to provide your	own mechanism.

   login_form_status($r): int
       This method returns the HTTP status code	that will be returned with the
       login form response.  The default behaviour is to return
       HTTP_FORBIDDEN, except for some known browsers which ignore HTML
       content for HTTP_FORBIDDEN responses (e.g.: SymbianOS).	You can
       override	this method to return custom codes.

       Note that HTTP_FORBIDDEN	is the most correct code to return as the
       given request was not authorized	to view	the requested page.  You
       should only change this if HTTP_FORBIDDEN does not work.

   logout($r): void
       This is simply a	convenience method that	unsets the session key for
       you.  You can call it in	your logout scripts.  Usually this looks like

   params($r): Apache2::AuthCookie::Params
       Get the GET/POST	params object for this request.

   recognize_user($r): int
       If the user has provided	a valid	session	key but	the document isn't
       protected, this method will set "$r->user" anyway.  Use it as a
       PerlFixupHandler, unless	you have a better idea.

   remove_cookie($r): void
       Adds a "Set-Cookie" header that instructs the client to delete the
       cookie immediately.

   requires_encoding($r): string
       Return the ${auth_name}RequiresEncoding setting that is in effect for
       this request.

   send_cookie($r, $ses_key, $args): void
       By default this method simply sends out the session key you give	it.
       If you need to change the default behavior (perhaps to update a
       timestamp in the	key) you can override this method.

   send_p3p($r): void
       Set a P3P response header if "${auth_name}P3P" is configured.  The
       value of	the header is whatever is in the "${auth_name}P3P" setting.

   untaint_destination($destination): string
       This method returns a modified version of the destination parameter
       before embedding	it into	the response header. Per default it escapes
       CR, LF and TAB characters of the	uri to avoid certain types of security
       attacks.	You can	override it to more limit the allowed destinations,
       e.g., only allow	relative uris, only special hosts or only limited set
       of characters.

       The development version is on github at
       <> and may be	cloned from

       Please report any bugs or feature requests to or through the	web interface at:

       Michael Schout <>

       This software is	copyright (c) 2000 by Ken Williams.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

perl v5.24.1			  2016-09-30	  Apache2::AuthCookie::Base(3)


Want to link to this manual page? Use this URL:

home | help