util::http::cookie_auth (public)

 util::http::cookie_auth [ -headers headers ] [ -auth_vars auth_vars ] \
    [ -auth_url auth_url ] [ -auth_form auth_form ] \
    [ -auth_cookies auth_cookies ] [ -preference preference ]

Defined in packages/acs-tcl/tcl/http-client-procs.tcl

This proc implements the generic pattern for cookie-based authentication: user logs in a webpage providing username, password and optionally other information in a form, page replies generating one or more authentication cookies by which user will be recognized on subsequent interaction with the server. By this method was possible, for example, to authenticate on a remote OpenACS installation providing 'email' and 'password' as credentials to the /register/ page, and using 'ad_session_id' and 'ad_user_login' as 'auth_cookies'. This proc is a bit hacky and is nowadays not clear if it makes sense anymore... This proc takes care to submit to the login form also every other formfield on the login page. This is important because this (often hidden) formfields can contain tokens necessary for the authentication process.

Switches:
-headers (optional)
ns_set of request headers that will be populated with auth headers. If not specified, a new ns_set will be created. Existing cookies will be overwritten.
-auth_vars (optional)
Variables issued to the login page in 'export_vars -url' form.
-auth_url (optional)
Login url
-auth_form (optional)
Form to put our data into. If not specified, there must be only one form on the login page, otherwise proc will throw an error.
-auth_cookies (optional)
Cookies we should look for in the response from the login page to obtain authentication data. If not specified, this will refer to every cookie received into 'set-cookie' response headers.
-preference (optional, defaults to "native curl")
Returns:
ns_set of headers containing authentication data

Partial Call Graph (max 5 caller/called nodes):
%3 export_vars export_vars (public) util::html::get_form util::html::get_form (public) util::html::get_form_vars util::html::get_form_vars (public) util::html::get_forms util::html::get_forms (public) util::http::get util::http::get (public) util::http::cookie_auth util::http::cookie_auth util::http::cookie_auth->export_vars util::http::cookie_auth->util::html::get_form util::http::cookie_auth->util::html::get_form_vars util::http::cookie_auth->util::html::get_forms util::http::cookie_auth->util::http::get

Testcases:
No testcase defined.
[ show source ]
Show another procedure: