Forum OpenACS Q&A: Re: How to use/configure Host Node Map

Collapse
Posted by Dave Bauer on
Host node mapping is great when you want to share logins and passwords.

We developed a local hack to log you into multiple host node mapped sites with one login.

It basically uses a server side secret to redirect to the login page of the other subsite(s) when you login to one, to get multiple login cookies.

Collapse
Posted by Torben Brosten on
Hey Dave, that's great! I think it is a critical piece to host node mapping services. Can you share it, if not publish, then email to me?
Collapse
Posted by Dave Bauer on
# packages/acs-subsite/www/register/hash-login.tcl      
# This allows logging a user into multiple host node mapped subsites using the auth token from a current login on one of the other host node mapped subsites                        
# TODO make sure the host is a valid host node mapped URL

ad_page_contract {

    auto-login using user_id, hash, time and token_id

    @author Deds Castillo
    @creation-date 2009-08-26
} {
    {user_id:optional,trim ""}
    {time:optional,trim ""}
    {hash:optional,trim ""}
    {return_url "/"}
    {host ""}
} -properties {
} -validate {
} -errors {
}

if { $user_id ne "" && \
         $time ne "" && \
         $hash ne "" } {

    set token [sec_get_user_auth_token $user_id]
    set computed_hash [ns_sha1 "$user_id$time$token"]

    set expiration_time 30
    if { [string compare $hash $computed_hash] != 0 || \
             $time < [ns_time] - $expiration_time } {
        # expired or wrong credentials                                          
    } else {
        ad_user_login $user_id
    }
}

if { [string match "http*" $return_url] } {
    set next_url $return_url
} else {
    set next_url "${host}${return_url}"
}

ad_returnredirect $next_url
Collapse
Posted by Dave Bauer on
One way to support multiple unassociated hosts in one database is to support multiple local acs-authentication authorities and to key the unique username/email constraint on the authority_id.

This way you could have completely seperate logins per host mapped subsite. As far as I know noone has implemented this yet.

Collapse
Posted by Torben Brosten on
Dave, How is this called?