diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-11-01 22:06:34 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-11-01 22:06:34 +0000 |
commit | 01556e1128f60bd3252d6f31c73eeb797bec9d98 (patch) | |
tree | 6ff1babfb6c40b366f1cb20c08a2d14adb1eda2c /LedgerSMB/Session | |
parent | 276e52fe93b5090c51aa18746d66bf1d39cd0920 (diff) |
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
Diffstat (limited to 'LedgerSMB/Session')
-rwxr-xr-x | LedgerSMB/Session/DB.pm | 19 |
1 files changed, 19 insertions, 0 deletions
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; |