[LON-CAPA-cvs] cvs: loncom /auth switchserver.pm
raeburn
raeburn at source.lon-capa.org
Sun Jun 27 13:25:47 EDT 2021
raeburn Sun Jun 27 17:25:47 2021 EDT
Modified files:
/loncom/auth switchserver.pm
Log:
- Support case where SSO is used on a LON-CAPA loadbalancer node.
Optional lonSSOUserLogoutScriptFile PerlVar can be defined in the Apache
config file (e.g. loncapa_apache_local.conf) e.g., to load custom javascript
into the switchserver page to when switching. (e.g., an XMLHttpRequest call).
Index: loncom/auth/switchserver.pm
diff -u loncom/auth/switchserver.pm:1.55 loncom/auth/switchserver.pm:1.56
--- loncom/auth/switchserver.pm:1.55 Tue May 4 18:47:37 2021
+++ loncom/auth/switchserver.pm Sun Jun 27 17:25:47 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Switch Servers Handler
#
-# $Id: switchserver.pm,v 1.55 2021/05/04 18:47:37 raeburn Exp $
+# $Id: switchserver.pm,v 1.56 2021/06/27 17:25:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -57,7 +57,7 @@
my ($r,$url,$only_body,$extra_text) = @_;
$r->send_http_header;
my $delay = 0.5;
- if ($only_body) {
+ if ($only_body && !$extra_text) {
$delay = 0;
}
my $start_page =
@@ -291,8 +291,23 @@
if ($env{'form.symb'}) {
$info{'symb'} = $env{'form.symb'};
}
+ my $ssologoutscript = '';
if ($env{'request.sso.login'}) {
$info{'sso.login'} = $env{'request.sso.login'};
+ my $dom = $env{'user.domain'};
+ if (defined($r->dir_config("lonSSOUserLogoutScriptFile_$info{domain}"))) {
+ if (open(my $fh,'<',$r->dir_config("lonSSOUserLogoutScriptFile_$info{domain}"))) {
+ $ssologoutscript .= join('',<$fh>);
+ close($fh);
+ }
+ }
+ if ($env{'request.sso.login'}
+ && defined($r->dir_config('lonSSOUserLogoutScriptFile'))) {
+ if (open(my $fh,'<',$r->dir_config('lonSSOUserLogoutScriptFile'))) {
+ $ssologoutscript .= join('',<$fh>);
+ close($fh);
+ }
+ }
}
if ($env{'request.sso.reloginserver'}) {
$info{'sso.reloginserver'} = $env{'request.sso.reloginserver'};
@@ -345,7 +360,7 @@
'&username='.$env{'user.name'}.
'&token='.$token;
# --------------------------------------------------------------- Screen Output
- return &do_redirect($r, $url, $only_body);
+ return &do_redirect($r, $url, $only_body, $ssologoutscript);
}
1;
More information about the LON-CAPA-cvs
mailing list