From b16576ebcb06a5c9c7d5359254ae1a70db2ec044 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 19 Nov 2021 15:32:01 -0500 Subject: [PATCH] print user name on cas login status page --- themes/fsftheme/casserver/loggedIn.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/themes/fsftheme/casserver/loggedIn.php b/themes/fsftheme/casserver/loggedIn.php index ee5bb67..8fe436b 100644 --- a/themes/fsftheme/casserver/loggedIn.php +++ b/themes/fsftheme/casserver/loggedIn.php @@ -27,7 +27,16 @@ $this->includeAtTemplateBase('includes/header.php');

t('{fsfdrupalauth:fsfdrupalauth:loggedin_as_description}') . "..."; + $casconfig = SimpleSAML_Configuration::getConfig('module_casserver.php'); + + $auth = new SimpleSAML\Auth\Simple($casconfig->getValue('authsource')); + $attrs = $auth->getAttributes(); + + if (!isset($attrs['name'][0])) { + throw new Exception('fsfdrupalauth: "name" attribute missing.'); + } + + echo $this->t('{fsfdrupalauth:fsfdrupalauth:loggedin_as_description}') . "" . htmlspecialchars($attrs['name'][0]) . "."; ?>

-- 2.25.1