NAME

Dispatcher - dispatch CAS login and validation amoung multiple CAS servers.


SYNOPSIS

    use Dispatcher;
    $dp = new Dispatcher;
    $dp->conf_read ('servers.conf');
    if ($dp->cas_server) {
        $srv = $dp->cas_server;
        $url = $dp->conf ($srv, 'cas_login');
        if ($url =~ /\?/) {
            $url .= '&';
        } else {
            $url .= '?';
        }
        $url .= 'service=' . $dp->service ($srv);
        $dp->http_redirect ($url);
    } else {
        $dp->http_reply ($dp->screen ('login'));
    }


DESCRIPTION

This module allows the dispatching of CAS requests between multiple CAS servers. It does this by allowing the end-user to select the appropriate CAS server on initial login and thereafter using a cookie to corectly foward all login requests for that user to the chosen server.

new

Create a new Dispatcher object.

param (name)

Return the CGI parameter specified by name. This method uses the param method of the standard CGI module.

cookie (%args)

Sets or return a cookie. This method uses the cookie method of the standard CGI module. See the documentation of that modules for full description. The basic parameters are cookie (-name => 'cookie_name'), to read a cookie and cookie (-name => 'cookie_name', -value => 'cookie_value'), to set a cookie.

service (server, [skip_enc])

Readers the original service CGI parameter (login or validate) and generate a combined service string to be used for CAS server requests. The server parameter is the code name for the selected CAS server, as defined in the configuration table. If skip_enc is true, the final service string is not URL encoded. This can be useful when passing it to a service which does it's own URL encoding. The combined service string is returned.

cas_server

Return the CAS service code as selected in the server dropdown or as defined by the cas_dispatcher_server cookie. An HTTP 500 error is returned directly to the web-client if the config file could not be read.

conf_read (file)

Read the configuration file containing CAS server definitions or various organisations.

conf ([server, field])

Return a configuration field for the CAS server specified by server. If server and field are omitted, a list of CAS server IDs is returned.

screen (name)

Parse and return screen template specified by name. To the value of name will be automatically appened the value of the lang CGI parameter and the .html extension. Because the language is optional, it will look for screens with and without the languages extension. For example, if lang as the value eng, and name is login, the system will first check for a template called login.eng.html and then for login.html. During the parsing, the only tag curently replace is <dispatcher:cas_server_select/> which is replace with a select HTML form statenment containing the name of all CAS servers defined in the config.

http_reply (text)

Return text as text/html.

http_redirect (location, [cookie_name => cookie_value, ...])

Does an HTTP redirect with status 302 to the URL specified in location. Optionally can set any number of cookies based on name/value pair passed.

http_error (status, msg)

Returns a HTTP error with error status as specified in status and msg as the replies body.


AUTHOR

Franck, franck@cvt.dk


VERSION

1.5 2004/09/29 17:17:45