|
NAMEApache2::AuthCookie::Base - Common Methods Shared by Apache2 and Apache2_4 AuthCookie Subclasses.VERSIONversion 3.30DESCRIPTIONThis module contains common code shared by AuthCookie for Apache 2.x and Apache 2.4.METHODSauthenticate($r): intThis 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): stringReturn the name of the auth cookie for this request. This is either "${auth_name}CookieName", or AuthCookie's self generated name.cookie_string(%args): stringGenerate a cookie string. %args are:
All other cookie settings come from "PerlSetVar" settings. decoded_requires($r): arrayrefThis method returns the "$r->requires" array, with the "requirement" values decoded if "${auth_name}RequiresEncoding" is in effect for this request.decoded_user($r): stringIf you have set ${auth_name}Encoding, then this will return the decoded value of "$r->user".encoding($r): stringReturn the ${auth_name}Encoding setting that is in effect for this request.escape_uri($r, $value): stringEscape the given string so it is suitable to be used in a URL.get_cookie_path($r): stringReturns the value of "PerlSetVar ${auth_name}Path".handle_cache($r): voidIf "${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): stringThis 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): intThis 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): intThis 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): intThis 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): voidThis is simply a convenience method that unsets the session key for you. You can call it in your logout scripts. Usually this looks like "$r->auth_type->logout($r)".params($r): Apache2::AuthCookie::ParamsGet the GET/POST params object for this request.recognize_user($r): intIf 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): voidAdds a "Set-Cookie" header that instructs the client to delete the cookie immediately.requires_encoding($r): stringReturn the ${auth_name}RequiresEncoding setting that is in effect for this request.send_cookie($r, $ses_key, $args): voidBy 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): voidSet 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): stringThis 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.SOURCEThe development version is on github at <https://https://github.com/mschout/apache-authcookie> and may be cloned from <git://https://github.com/mschout/apache-authcookie.git>BUGSPlease report any bugs or feature requests on the bugtracker website <https://github.com/mschout/apache-authcookie/issues>When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHORMichael Schout <mschout@cpan.org>COPYRIGHT AND LICENSEThis 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.
Visit the GSP FreeBSD Man Page Interface. |