[LON-CAPA-cvs] cvs: loncom /auth lonlogin.pm

raeburn raeburn at source.lon-capa.org
Sun Oct 10 19:22:30 EDT 2021


raeburn		Sun Oct 10 23:22:30 2021 EDT

  Modified files:              
    /loncom/auth	lonlogin.pm 
  Log:
  - If SAML authentication (Shibboleth) is using /adm/login as landing page,
    delay deleting ltoken from tempdir, so it is available to lonacc::sso_login()
  - Append either ltoken or linkkey to landing page link to /adm/sso to support
    deep-linking. 
  
  
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.190 loncom/auth/lonlogin.pm:1.191
--- loncom/auth/lonlogin.pm:1.190	Fri Oct  8 14:45:45 2021
+++ loncom/auth/lonlogin.pm	Sun Oct 10 23:22:30 2021
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Login Screen
 #
-# $Id: lonlogin.pm,v 1.190 2021/10/08 14:45:45 raeburn Exp $
+# $Id: lonlogin.pm,v 1.191 2021/10/10 23:22:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -417,8 +417,6 @@
     }
     if ($env{'form.ltoken'}) {
         my %info = &Apache::lonnet::tmpget($env{'form.ltoken'});
-        &Apache::lonnet::tmpdel($env{'form.ltoken'});
-        delete($env{'form.ltoken'});
         if ($info{'linkprot'}) {
             if (!$tokenextras) {
                 $tokenextras = '&&&';
@@ -442,6 +440,10 @@
         if ($logtoken eq 'no_such_host') {
             &Apache::lonnet::logthis('No valid logtoken for log-in page -- unable to determine hostname for hostID: '.$lonhost.'. Check entry in hosts.tab');
         }
+        if ($env{'form.ltoken'}) {
+            &Apache::lonnet::tmpdel($env{'form.ltoken'});
+            delete($env{'form.ltoken'});
+        }
         my $spares='';
         my (@sparehosts,%spareservers);
         my $sparesref = &Apache::lonnet::this_host_spares($defdom);
@@ -819,6 +821,13 @@
             $querystring = &HTML::Entities::encode($querystring,"'");
             $ssologin .= (($ssologin=~/\?/)?'&':'?') . $querystring;
         }
+        if ($env{'form.ltoken'} ne '') {
+            $querystring .= (($querystring eq '')?'':'&') . 'ltoken='.
+                              &HTML::Entities::encode(&uri_escape($env{'form.ltoken'}));
+        } elsif ($env{'form.linkkey'}) {
+            $querystring .= (($querystring eq '')?'':'&') . 'linkkey='.
+                              &HTML::Entities::encode(&uri_escape($env{'form.linkkey'}));
+        }
         my $ssohref;
         if ($samlssoimg ne '') {
             $ssohref = '<a href="'.$ssologin.'" title="'.$samltooltip.'"><img src="'.$samlssoimg.'" alt="'.$samlssoalt.'" /></a>';
@@ -849,6 +858,11 @@
 </div>
 </div>
 ENDSAML
+    } else {
+        if ($env{'form.ltoken'}) {
+            &Apache::lonnet::tmpdel($env{'form.ltoken'});
+            delete($env{'form.ltoken'});
+        }
     }
 
     $r->print(<<ENDLOGIN);




More information about the LON-CAPA-cvs mailing list