ad_user_login (public)

 ad_user_login [ -account_status account_status ] \
    [ -cookie_domain cookie_domain ] \
    [ -external_registry external_registry ] [ -forever ] user_id

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

Logs the user in, forever (via the user_login cookie) if -forever is true. This procedure assumes that the user identity has been validated.

Switches:
-account_status (optional, defaults to "ok")
-cookie_domain (optional)
-external_registry (optional)
-forever (optional, boolean)
Parameters:
user_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 test_logout_from_everywhere logout_from_everywhere (test acs-tcl) ad_user_login ad_user_login test_logout_from_everywhere->ad_user_login ad_conn ad_conn (public) ad_user_login->ad_conn ad_set_signed_cookie ad_set_signed_cookie (public) ad_user_login->ad_set_signed_cookie ad_unset_cookie ad_unset_cookie (public) ad_user_login->ad_unset_cookie parameter::get parameter::get (public) ad_user_login->parameter::get sec_get_user_auth_token sec_get_user_auth_token (public) ad_user_login->sec_get_user_auth_token Class ::xo::Authorize Class ::xo::Authorize (public) Class ::xo::Authorize->ad_user_login acs::test::set_user acs::test::set_user (private) acs::test::set_user->ad_user_login auth::authenticate auth::authenticate (public) auth::authenticate->ad_user_login auth::create_user auth::create_user (public) auth::create_user->ad_user_login auth::issue_login auth::issue_login (public, deprecated) auth::issue_login->ad_user_login

Testcases:
logout_from_everywhere
Source code:
    set prev_user_id [ad_conn user_id]

    #
    # Deal with the permanent login cookies (user_login and
    # user_login_secure).
    #
    if { $forever_p } {
        set max_age inf
    } else {
        # user_login cookie will live for as long as the maximum login time
        set max_age [sec_login_timeout]
    }

    set auth_level "ok"
    set secure_p [expr {[security::secure_conn_p] || [ad_conn behind_secure_proxy_p]}]
    if {$cookie_domain eq ""} {
        set cookie_domain [parameter::get -parameter CookieDomain -package_id $::acs::kernel_id]
    }

    ::security::log login_cookie "ad_user_login sec_get_user_auth_token $user_id '[sec_get_user_auth_token $user_id]'"
    # If you're logged-in over a secure connection, you're secure
    if { $secure_p } {
        ad_set_signed_cookie  -max_age $max_age  -secure t  -domain $cookie_domain  [security::cookie_name user_login_secure]  "$user_id,[ns_time],[sec_get_user_auth_token $user_id],[ns_time],$forever_p,$external_registry"

        # We're secure
        set auth_level "secure"
    } elseif$prev_user_id != $user_id } {
        # Hose the secure login token if this user is different
        # from the previous one.
        ad_unset_cookie -secure t [security::cookie_name user_login_secure]
    }

    #
    # Set "user_login" Cookie always with secure=f for mixed
    # content.
    #
    ns_log Debug "ad_user_login: Setting new user_login cookie with max_age $max_age"
    ad_set_signed_cookie  -expire [expr {$forever_p ? false : true}]  -max_age $max_age  -domain $cookie_domain  -secure f  [security::cookie_name user_login]  "$user_id,[ns_time],[sec_get_user_auth_token $user_id],$forever_p,$external_registry"

    # deal with the current session
    sec_setup_session -cookie_domain $cookie_domain $user_id $auth_level $account_status
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: