2 # $Id: setauth.tcl 764 2007-10-23 23:44:49Z hubert@u.washington.edu $
3 # ========================================================================
4 # Copyright 2006 University of Washington
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # ========================================================================
16 # Purpose: CGI script to generate html form used to ask for authentication
21 {cid
"Missing Command ID"}
22 {authcol
"No Authorization Collection"}
23 {authfolder
"No Authorization Folder"}
24 {authpage
"No Post Authorization Instructions"}
25 {authcancel
"No Auth Cancel Instructions"}
34 # Redirect to specified post-authentication page
36 # inherit global config
42 if {$cid != [WPCmd PEInfo key
]} {
43 error [list _action
open "Invalid Operation ID" "Click Back button to try again."]
47 if {[string compare
$auths "Login"] == 0
48 && [string length
$user]
49 && [catch {WPCmd PESession creds
$authcol $authfolder $user $pass}] == 0} {
50 set redirect
$authpage
52 set redirect
$authcancel
56 # redirect to the place we stuffed the export info. use the ip address
57 # to foil spilling any session cookies or the like
59 if {[info exists env
(SERVER_PROTOCOL
)] && [regexp {[Hh
][Tt
][Tt
][PP
]/([0-9]+)\.
([0-9]+)} $env(SERVER_PROTOCOL
) m vmaj vmin
] && $vmaj >= 1 && $vmin >= 1} {
60 cgi_puts
"Status: 303 Temporary Redirect"
62 cgi_puts
"Status: 302 Redirected"
65 cgi_puts
"URI: $redirect"
66 cgi_puts
"Location: $redirect"