--- loncom/auth/lonshibauth.pm 2021/10/07 15:51:16 1.7 +++ loncom/auth/lonshibauth.pm 2021/10/07 18:52:03 1.8 @@ -1,7 +1,7 @@ # The LearningOnline Network # Redirect Shibboleth authentication to designated URL (/adm/sso). # -# $Id: lonshibauth.pm,v 1.7 2021/10/07 15:51:16 raeburn Exp $ +# $Id: lonshibauth.pm,v 1.8 2021/10/07 18:52:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -94,8 +94,16 @@ sub handler { if ($ENV{'QUERY_STRING'} ne '') { $dest .= '?'.$ENV{'QUERY_STRING'}; } - unless (($uri eq '/adm/roles') || ($ENV{'QUERY_STRING'} =~ /origurl=/)) { - $dest.=(($dest=~/\?/)?'&':'?').'origurl='.$uri; + unless (($uri eq '/adm/roles') || ($uri eq '/adm/logout')) { + if ($target eq '/adm/login') { + unless ($ENV{'QUERY_STRING'} =~ /firsturl=/) { + $dest.=(($dest=~/\?/)?'&':'?').'firsturl='.$uri; + } + } else { + unless ($ENV{'QUERY_STRING'} =~ /origurl=/)) { + $dest.=(($dest=~/\?/)?'&':'?').'origurl='.$uri; + } + } } $r->header_out(Location => $dest); return REDIRECT;