1#!/bin/sh 2# zxidhlo.sh - Hello World CGI shell script for SAML 2 SP 3# Copyright (c) 2007 Symlabs (symlabs@symlabs.com), All Rights Reserved. 4# Author: Sampo Kellomaki (sampo@iki.fi) 5# This is confidential unpublished proprietary source code of the author. 6# NO WARRANTY, not even implied warranties. Contains trade secrets. 7# Distribution prohibited unless authorized in writing. 8# Licensed under Apache License 2.0, see file COPYING. 9# $Id: zxidhlo.sh,v 1.6 2009-08-30 15:09:26 sampo Exp $ 10# 11# 16.1.2007, created --Sampo 12# 13# See also: http://hoohoo.ncsa.uiuc.edu/cgi/interface.html (CGI specification) 14# README-zxid, section 10 "zxid_simple() API" 15# 16# N.B. This shell script needs to find zxidsimple(1) program, which see, in its path. 17 18CONF="PATH=/var/zxid/&URL=https://sp1.zxidsp.org:8443/zxidhlo.sh" 19./zxidsimple -o /tmp/zxidhlo.sh.$$ $CONF 4095 || exit; 20#echo "exit=$?" >>/tmp/hlo.err 21 22# First we split the result of the backtick into a list on (literal) 23# newline. Then we process the list with for loop and look with case 24# for the interesting attributes and capture them into local variables. 25IFS=" 26" 27res=`cat /tmp/zxidhlo.sh.$$` 28#echo "=====RES($res)" >>/tmp/hlo.err 29case "$res" in 30dn*) 31 for x in $res; do 32 case "$x" in 33 sesid:*) SID=${x##*sesid: } ;; 34 idpnid:*) NID=${x##*idpnid: } ;; 35 cn:*) CN=${x##*cn: } ;; 36 esac 37 done 38 ;; 39*) echo "ERROR($res)" >>/tmp/hlo.err; exit ;; 40esac 41 42cat << EOF 43Content-Type: text/html 44 45<title>ZXID HELLO SP Mgmt</title> 46<h1>ZXID HELLO SP Management (user $CN logged in, session active)</h1> 47<form method=post action="zxidhlo.sh?o=P"> 48<input type=hidden name=s value="$SID"> 49<input type=submit name=gl value=" Local Logout "> 50<input type=submit name=gr value=" Single Logout (Redir) "> 51<input type=submit name=gs value=" Single Logout (SOAP) "> 52<input type=submit name=gt value=" Defederate (Redir) "> 53<input type=submit name=gu value=" Defederate (SOAP) "> 54 55sid($SID) nid($NID) <a href="zxid?s=$SID">Reload</a> 56 57</form><hr> 58<a href="http://zxid.org/">zxid.org</a> 59EOF 60 61# EOF -- zxidhlo.sh 62