Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| de:shibslohttpd:helperscripts [2015/12/08 16:08] – [checker.php] Schreiterer, Frank | de:shibslohttpd:helperscripts [2019/02/28 12:25] (aktuell) – [logoutnotify.php] Schreiterer, Frank | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== | + | ====== |
| + | |||
| + | Alle hier aufgeführten Skripte sind beispielhaft und müssen ggf. angepasst werden. | ||
| ===== checker.php ===== | ===== checker.php ===== | ||
| + | |||
| + | Sorgt für den notwendigen zusätzlichen Request beim SessionHook. | ||
| <file php checker.php> | <file php checker.php> | ||
| - | <? php | + | <?php |
| //redirect to application | //redirect to application | ||
| header(' | header(' | ||
| + | ?> | ||
| + | </ | ||
| + | |||
| + | ===== initsess.php ===== | ||
| + | <file php initsess.php> | ||
| + | <?php | ||
| + | // | ||
| + | session_start(); | ||
| + | // | ||
| + | $path = " | ||
| + | //and redirect to application | ||
| + | $redirect = " | ||
| + | header(' | ||
| ?> | ?> | ||
| </ | </ | ||
| Zeile 12: | Zeile 29: | ||
| ===== logoutnotify.php ===== | ===== logoutnotify.php ===== | ||
| - | <file php> | + | Dieses Skript [[de: |
| + | |||
| + | < | ||
| <?php | <?php | ||
| // Sample PHP 5 Shibboleth logout code by lukas.haemmerle@switch.change_user | // Sample PHP 5 Shibboleth logout code by lukas.haemmerle@switch.change_user | ||
| Zeile 83: | Zeile 102: | ||
| // See function LogoutNotification below | // See function LogoutNotification below | ||
| - | elseif (!empty($HTTP_RAW_POST_DATA)) { | + | elseif (!empty(file_get_contents(" |
| // Set SOAP header | // Set SOAP header | ||
| $server = new SoapServer(' | $server = new SoapServer(' | ||
| Zeile 173: | Zeile 192: | ||
| // SessionID is stored in the user session data! | // SessionID is stored in the user session data! | ||
| | | ||
| - | | ||
| - | // | ||
| - | $dbDriver=" | ||
| - | $dbHost=" | ||
| - | $dbUser=" | ||
| - | $dbPass=" | ||
| - | $dbName=" | ||
| - | $dbPort=" | ||
| - | |||
| // | // | ||
| $mcsrv=" | $mcsrv=" | ||
| $mcport=" | $mcport=" | ||
| - | + | ||
| - | //mode memcached or DB | + | $mc=new Memcache; |
| - | $mode = " | + | $mc-> |
| - | #$mode = " | + | //get the application session id |
| - | + | $appsessionid = $mc-> | |
| - | if ($mode == " | + | //remove |
| - | //Remove the entry in shibchecker-DB and the aplication session | + | $ret = $mc-> delete($SessionID); |
| - | try { | + | $ret = $mc-> delete($appsessionid); |
| - | $pdo = new PDO(" | + | if ($appsessionid == false) { |
| - | //get the application session id | + | $appsessionid = ""; |
| - | $sqlappsess=" | + | |
| - | $appsessionid = ""; | + | |
| - | if ($res = $pdo-> | + | |
| - | while ($row = $res-> | + | |
| - | $appsessionid = $row[' | + | |
| - | } | + | |
| - | } | + | |
| - | if ($appsessionid != "" | + | |
| - | $sql=" | + | |
| - | $pdo-> | + | |
| - | $pdo = NULL; | + | |
| - | } | + | |
| - | } catch (PDOExeption $e) { | + | |
| - | return new SoapFault(' | + | |
| - | } | + | |
| - | } elseif ($mode == " | + | |
| - | $mc=new Memcache; | + | |
| - | $mc-> | + | |
| - | //get the application session id | + | |
| - | $appsessionid = $mc-> | + | |
| - | //remove | + | |
| - | $ret = $mc-> delete($SessionID); | + | |
| - | $ret = $mc-> delete($appsessionid); | + | |
| - | if ($appsessionid == false) { | + | |
| - | $appsessionid = ""; | + | |
| - | } | + | |
| } | } | ||
| + | |||
| //Connect to the application session (PHP Session) | //Connect to the application session (PHP Session) | ||
| session_id($appsessionid); | session_id($appsessionid); | ||
| Zeile 232: | Zeile 217: | ||
| ?> | ?> | ||
| </ | </ | ||
| + | |||
| + | ===== remsess.php ===== | ||
| + | |||
| + | <file php remsess.php> | ||
| + | <?php | ||
| + | |||
| + | /* | ||
| + | This program is free software: you can redistribute it and/or modify | ||
| + | it under the terms of the GNU General Public License as published by | ||
| + | the Free Software Foundation, either version 3 of the License, or | ||
| + | any later version. | ||
| + | |||
| + | This program is distributed in the hope that it will be useful, | ||
| + | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| + | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| + | GNU General Public License for more details. | ||
| + | |||
| + | You should have received a copy of the GNU General Public License | ||
| + | along with this program. | ||
| + | | ||
| + | Copyright 2015 Frank Schreiterer, | ||
| + | */ | ||
| + | |||
| + | function removeMemcached($destid) { | ||
| + | $mcsrv=" | ||
| + | $mcport=" | ||
| + | $mc=new Memcache; | ||
| + | $mc-> | ||
| + | $stats = $mc-> | ||
| + | $list = array(); | ||
| + | #memcached auslesen und bei passendem Wert den Key entfernen | ||
| + | $allSlabs = $mc-> | ||
| + | $items = $mc-> | ||
| + | foreach($allSlabs as $server => $slabs) { | ||
| + | foreach($slabs AS $slabId => $slabMeta) { | ||
| + | if (is_numeric($slabId)) { | ||
| + | $cdump = $mc-> | ||
| + | foreach($cdump AS $keys => $arrVal) { | ||
| + | if (!is_array($arrVal)) continue; | ||
| + | foreach($arrVal AS $k => $v) { | ||
| + | $get = $mc-> | ||
| + | if ($get == $destid) { | ||
| + | $ret = $mc-> | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | #und bei mixedLazy den Sicherungseintrag zur destid | ||
| + | $ret = $mc-> | ||
| + | $mc-> | ||
| + | } | ||
| + | |||
| + | #eine böse Anwendungs-Session-ID zerstören | ||
| + | if (isset($_REQUEST[' | ||
| + | $destid = $_REQUEST[' | ||
| + | if ($destid != "" | ||
| + | session_id($destid); | ||
| + | removeMemcached($destid); | ||
| + | session_start(); | ||
| + | session_destroy(); | ||
| + | } | ||
| + | } | ||
| + | |||
| + | session_start(); | ||
| + | $serverurl=" | ||
| + | if (isset($_REQUEST[' | ||
| + | $shiblogoff = $_REQUEST[' | ||
| + | if ($shiblogoff == " | ||
| + | echo "Sie wurden abgemeldet.< | ||
| + | } | ||
| + | } else { | ||
| + | |||
| + | $destid = session_id(); | ||
| + | removeMemcached($destid); | ||
| + | |||
| + | $url=" | ||
| + | header(' | ||
| + | } | ||
| + | |||
| + | session_destroy(); | ||
| + | # | ||
| + | setcookie(session_name(),"", | ||
| + | ?> | ||
| + | |||
| + | </ | ||
| + | |||