Bugzilla – Attachment 187031 Details for
Bug 40736
OAuth/OIDC authentication logs error message when CGISESSID is missing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40736: Gracefully handle missing CGISESSID cookie
Bug-40736-Gracefully-handle-missing-CGISESSID-cook.patch (text/plain), 1.80 KB, created by
Lari Taskula
on 2025-09-29 11:28:29 UTC
(
hide
)
Description:
Bug 40736: Gracefully handle missing CGISESSID cookie
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2025-09-29 11:28:29 UTC
Size:
1.80 KB
patch
obsolete
>From ae6d5da4918278789e4847dfe9349ed95e8992a3 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Fri, 26 Sep 2025 02:24:29 +0000 >Subject: [PATCH] Bug 40736: Gracefully handle missing CGISESSID cookie > >This change makes the REST API gracefully handle >a missing CGISESSID when trying to do an OAuth/OIDC login >by direct linking. > >Test plan: >0. Apply the patch and koha-plack --restart kohadev >1. Set up an OpenID Connect client using the wiki >https://wiki.koha-community.org/wiki/Testing_SSO >2. In an incognito/private window, try directly logging in >with the following URL: >http://localhost:8080/api/v1/public/oauth/login/test/opac >3. Note that you're redirected to opac-user.pl with an auth error >message of "No user session found" >4. Close the incognito/private window >5. In an incognito/private window, try directly logging in >with the following URL: >http://localhost:8081/api/v1/oauth/login/test/staff >6. Note that you're redirected to mainpage.pl with an auth error >message of "No user session found" > >Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi> >--- > Koha/REST/V1/OAuth/Client.pm | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/Koha/REST/V1/OAuth/Client.pm b/Koha/REST/V1/OAuth/Client.pm >index 9b84edc9809..2b99b64fcfe 100644 >--- a/Koha/REST/V1/OAuth/Client.pm >+++ b/Koha/REST/V1/OAuth/Client.pm >@@ -68,6 +68,11 @@ sub login { > return $c->redirect_to( $uri . "?auth_error=$error" ); > } > >+ if ( !$c->req->cookie('CGISESSID') ) { >+ my $error = "No user session found"; >+ return $c->redirect_to( $uri . "?auth_error=$error" ); >+ } >+ > unless ( $provider_config->{authorize_url} =~ /response_type=code/ ) { > my $authorize_url = Mojo::URL->new( $provider_config->{authorize_url} ); > $authorize_url->query->append( response_type => 'code' ); >-- >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 40736
:
186651
|
186950
| 187031 |
187032
|
187033