Skip to content

Commit

Permalink
Added example for authenticating
Browse files Browse the repository at this point in the history
Updated changelog
  • Loading branch information
evert committed Jan 14, 2009
1 parent 25e8352 commit f964a96
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* Added: Added a very simple example for implementing a mapping to PHP
file streams. This should allow easy implementation of for example a
WebDAV to FTP proxy.
* Added: HTTP Basic Authentication helper class.
* Added: Sabre_HTTP_Reponse class. This centralizes HTTP operations and
will be a start towards the creating of a testing framework.
* Updated: Backwards compatibility break: all require_once() statements
are removed
from all the files. It is now recommended to use autoloading of
Expand Down
28 changes: 28 additions & 0 deletions examples/authenticating.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

// !!!! Make sure the Sabre directory is in the include_path !!!

// {$Id$} //

// settings
date_default_timezone_set('Canada/Eastern');

// Files we need
require_once 'Sabre.includes.php';

$u = 'admin';
$p = '1234';

$auth = new Sabre_HTTP_BasicAuth();

$result = $auth->getUserPass();

if (!$result || $result[0]!=$u || $result[1]!=$p) {

$auth->requireLogin();
echo "Authentication required\n";
die();

}

?>

0 comments on commit f964a96

Please sign in to comment.