[LON-CAPA-cvs] cvs: loncom /auth lonacc.pm lonshibauth.pm
raeburn
raeburn at source.lon-capa.org
Tue Jun 22 12:56:35 EDT 2021
raeburn Tue Jun 22 16:56:35 2021 EDT
Modified files:
/loncom/auth lonshibauth.pm lonacc.pm
Log:
- Go to originally requested URL after single sign on with Shibboleth.
Index: loncom/auth/lonshibauth.pm
diff -u loncom/auth/lonshibauth.pm:1.4 loncom/auth/lonshibauth.pm:1.5
--- loncom/auth/lonshibauth.pm:1.4 Tue May 4 18:47:37 2021
+++ loncom/auth/lonshibauth.pm Tue Jun 22 16:56:35 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Redirect Shibboleth authentication to designated URL (/adm/sso).
#
-# $Id: lonshibauth.pm,v 1.4 2021/05/04 18:47:37 raeburn Exp $
+# $Id: lonshibauth.pm,v 1.5 2021/06/22 16:56:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -74,7 +74,8 @@
sub handler {
my $r = shift;
my $target = '/adm/sso';
- if (($r->user eq '') && ($r->uri() ne $target)) {
+ my $uri = $r->uri;
+ if (($r->user eq '') && ($uri ne $target)) {
my $lonhost = $Apache::lonnet::perlvar{'lonHostID'};
my $hostname = &Apache::lonnet::hostname($lonhost);
if (!$hostname) { $hostname = $r->hostname(); }
@@ -87,6 +88,11 @@
if ($ENV{'QUERY_STRING'} ne '') {
$dest .= '?'.$ENV{'QUERY_STRING'};
}
+ if ($uri ne '/adm/roles/') {
+ unless ($ENV{'QUERY_STRING'} =~ /origurl=/) {
+ $dest.=(($dest=~/\?/)?'&':'?').'origurl='.$uri;
+ }
+ }
$r->header_out(Location => $dest);
return REDIRECT;
} else {
Index: loncom/auth/lonacc.pm
diff -u loncom/auth/lonacc.pm:1.190 loncom/auth/lonacc.pm:1.191
--- loncom/auth/lonacc.pm:1.190 Tue May 4 18:47:37 2021
+++ loncom/auth/lonacc.pm Tue Jun 22 16:56:35 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Cookie Based Access Handler
#
-# $Id: lonacc.pm,v 1.190 2021/05/04 18:47:37 raeburn Exp $
+# $Id: lonacc.pm,v 1.191 2021/06/22 16:56:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -305,7 +305,7 @@
my $query = $r->args;
my %form;
if ($query) {
- my @items = ('role','symb','iptoken');
+ my @items = ('role','symb','iptoken','origurl');
&Apache::loncommon::get_unprocessed_cgi($query,\@items);
foreach my $item (@items) {
if (defined($env{'form.'.$item})) {
@@ -367,7 +367,7 @@
foreach my $item (keys(%form)) {
$env{'form.'.$item} = $form{$item};
}
- unless ($form{'symb'}) {
+ unless (($form{'symb'}) || ($form{'origurl'})) {
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) {
$env{'form.origurl'} = $r->uri;
}
@@ -393,12 +393,12 @@
'server' => $r->dir_config('lonHostID'),
'sso.login' => 1
);
- foreach my $item ('role','symb','iptoken') {
+ foreach my $item ('role','symb','iptoken','origurl') {
if (exists($form{$item})) {
$info{$item} = $form{$item};
}
}
- unless ($info{'symb'}) {
+ unless (($info{'symb'}) || ($info{'origurl'})) {
unless (($r->uri eq '/adm/roles') || ($r->uri eq '/adm/sso')) {
$info{'origurl'} = $r->uri;
}
More information about the LON-CAPA-cvs
mailing list