sec_generate_session_id_cookie (private)

 sec_generate_session_id_cookie [ -cookie_domain cookie_domain ]

Defined in packages/acs-tcl/tcl/security-procs.tcl

Sets the "session_id" cookie based on global variables.

Switches:
-cookie_domain (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 sec_handler sec_handler (private) sec_generate_session_id_cookie sec_generate_session_id_cookie sec_handler->sec_generate_session_id_cookie sec_setup_session sec_setup_session (private) sec_setup_session->sec_generate_session_id_cookie ad_conn ad_conn (public) sec_generate_session_id_cookie->ad_conn ad_set_signed_cookie ad_set_signed_cookie (public) sec_generate_session_id_cookie->ad_set_signed_cookie parameter::get parameter::get (public) sec_generate_session_id_cookie->parameter::get sec_login_read_cookie sec_login_read_cookie (private) sec_generate_session_id_cookie->sec_login_read_cookie sec_session_timeout sec_session_timeout sec_generate_session_id_cookie->sec_session_timeout

Testcases:
No testcase defined.
Source code:
    set user_id [ad_conn untrusted_user_id]
    #
    # Maybe we need the session_id of the cookie-domain
    #
    set session_id [ad_conn session_id]
    set auth_level [ad_conn auth_level]
    set account_status [ad_conn account_status]

    set login_level 0
    if { $auth_level eq "ok" || $auth_level eq "secure" } {
        if {$account_status eq "ok"} {
            set login_level 1
        } else {
            set login_level 2
        }
    }

    ns_log Debug "Security: [ns_time] sec_generate_session_id_cookie setting"  "session_id=$session_id, user_id=$user_id, login_level=$login_level"

    if {$cookie_domain eq ""} {
        set cookie_domain [parameter::get  -parameter CookieDomain  -package_id $::acs::kernel_id]
    }

    # Fetch the last value element of "user_login" or
    # "user_login_secure" cookie that indicates if user wanted to be
    # remembered when logging in.

    set discard t
    set max_age [sec_session_timeout]
    set login_info [sec_login_read_cookie]
    if {[dict get $login_info status] eq "OK"
        && [dict get $login_info forever_p]
    } {
        set discard f
        set max_age inf
    }

    ad_set_signed_cookie  -secure [expr {[parameter::get  -boolean  -parameter SecureSessionCookie  -package_id $::acs::kernel_id  -default 0] ? "t" : "f"}]  -discard $discard  -replace t  -max_age $max_age  -domain $cookie_domain  [security::cookie_name session_id]  "$session_id,$user_id,$login_level,[ns_time]"
Generic XQL file:
packages/acs-tcl/tcl/security-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/security-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/security-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: