From 59f89ca80666140061dcb4af45b7242eb5082ba3 Mon Sep 17 00:00:00 2001
From: Matthias Meusburger <matthias.meusburger@biblibre.com>
Date: Wed, 15 Nov 2017 10:50:27 +0000
Subject: [PATCH] Enable Shibboleth auto-provisioning for Plack

https://bugs.koha-community.org/show_bug.cgi?id=19625
---
 C4/Auth_with_shibboleth.pm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/C4/Auth_with_shibboleth.pm b/C4/Auth_with_shibboleth.pm
index 6b20511..1800968 100644
--- a/C4/Auth_with_shibboleth.pm
+++ b/C4/Auth_with_shibboleth.pm
@@ -119,7 +119,11 @@ sub _autocreate {
     my %borrower = ( $config->{matchpoint} => $match );
 
     while ( my ( $key, $entry ) = each %{$config->{'mapping'}} ) {
-        $borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || '';
+        if ( any { /(^psgi|^plack)/i } keys %ENV ) {
+            $borrower{$key} = ( $entry->{'is'} && $ENV{"HTTP_" . uc($entry->{'is'}) } ) || $entry->{'content'} || '';
+        } else {
+            $borrower{$key} = ( $entry->{'is'} && $ENV{ $entry->{'is'} } ) || $entry->{'content'} || '';
+        }
     }
 
     %borrower = AddMember_Auto( %borrower );
-- 
2.7.4