Bugzilla – Attachment 163494 Details for
Bug 34164
OAuth2/OIDC should redirect to page that initiated login
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Redirection to referring url for the googleopenidconnect service
0001-Allow-old-googleopenidconnect-service-to-redirect-to.patch (text/plain), 1.89 KB, created by
Nicholas van Oudtshoorn
on 2024-03-20 05:53:46 UTC
(
hide
)
Description:
Redirection to referring url for the googleopenidconnect service
Filename:
MIME Type:
Creator:
Nicholas van Oudtshoorn
Created:
2024-03-20 05:53:46 UTC
Size:
1.89 KB
patch
obsolete
>From 068db12616f56c45bc430013bff079597c68344a Mon Sep 17 00:00:00 2001 >From: Nicholas van Oudtshoorn <vanoudt@gmail.com> >Date: Wed, 20 Mar 2024 10:45:27 +0800 >Subject: [PATCH] Allow old googleopenidconnect service to redirect to > referring page if possible and appropriate > >--- > opac/svc/auth/googleopenidconnect | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > >diff --git a/opac/svc/auth/googleopenidconnect b/opac/svc/auth/googleopenidconnect >index 5a18c87a38..75a053212e 100755 >--- a/opac/svc/auth/googleopenidconnect >+++ b/opac/svc/auth/googleopenidconnect >@@ -214,10 +214,16 @@ elsif ( defined $query->param('code') ) { > > #handle redirect to main.pl, for private opac > my $uri; >- if (C4::Context->preference('OpacPublic') ) { >- $uri = '/cgi-bin/koha/opac-user.pl'; >- } else { >- $uri = '/cgi-bin/koha/opac-main.pl'; >+ my $referer = $session->param( 'auth-refer-uri' ); >+ if ( $referer =~ /^$host/ ) { >+ my $regex = qr/logout\.x=1/mp; >+ $uri = $referer =~ s/$regex//rg; >+ } else { >+ if (C4::Context->preference('OpacPublic') ) { >+ $uri = '/cgi-bin/koha/opac-user.pl'; >+ } else { >+ $uri = '/cgi-bin/koha/opac-main.pl'; >+ } > } > print $query->redirect( > -uri => $uri, >@@ -244,6 +250,7 @@ else { > my $openidstate = 'auth_'; > $openidstate .= sprintf( "%x", rand 16 ) for 1 .. 32; > $session->param( 'google-openid-state', $openidstate ); >+ $session->param( 'auth-refer-uri', $ENV{HTTP_REFERER} ); > $session->flush(); > > my $prompt = $query->param('reauthenticate') // q{}; >-- >2.34.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34164
:
163127
|
163128
|
163129
|
163493
|
163494
|
163495
|
163496
|
164979
|
164980