From 01556e1128f60bd3252d6f31c73eeb797bec9d98 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 1 Nov 2007 22:06:34 +0000 Subject: Moving Auth functions into Session handler git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1834 4979c152-3d1c-0410-bac9-87ea11338e46 --- LedgerSMB/Session/DB.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'LedgerSMB/Session') diff --git a/LedgerSMB/Session/DB.pm b/LedgerSMB/Session/DB.pm index 19896ae7..419ca5d3 100755 --- a/LedgerSMB/Session/DB.pm +++ b/LedgerSMB/Session/DB.pm @@ -241,6 +241,25 @@ sub session_destroy { } +sub get_credentials { + # Handling of HTTP Basic Auth headers + my $auth = $ENV{'HTTP_AUTHORIZATION'}; + $auth =~ s/Basic //i; # strip out basic authentication preface + $auth = MIME::Base64::decode($auth); + my $return_value = {}; + ($return_value->{login}, $return_value->{password}) = split(/:/, $auth); + + return $return_value; + +} + +sub credential_prompt{ + print "WWW-Authenticate: Basic realm=\"LedgerSMB\"\n"; + print "Status: 401 Unauthorized\n\n"; + print "Please enter your credentials.\n"; + exit; +} + sub password_check { use Digest::MD5; -- cgit v1.2.3