diff options
Diffstat (limited to 'admin/survey/minify/vendor/intervention/httpauth')
20 files changed, 856 insertions, 0 deletions
diff --git a/admin/survey/minify/vendor/intervention/httpauth/.gitignore b/admin/survey/minify/vendor/intervention/httpauth/.gitignore new file mode 100644 index 0000000..750450c --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/.gitignore @@ -0,0 +1,3 @@ +.DS_Store
+composer.lock
+vendor/
\ No newline at end of file diff --git a/admin/survey/minify/vendor/intervention/httpauth/.travis.yml b/admin/survey/minify/vendor/intervention/httpauth/.travis.yml new file mode 100644 index 0000000..0edb59c --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/.travis.yml @@ -0,0 +1,11 @@ +language: php
+
+php:
+ - 5.3
+ - 5.4
+
+before_script:
+ - curl -s http://getcomposer.org/installer | php
+ - php composer.phar install --dev
+
+script: phpunit
\ No newline at end of file diff --git a/admin/survey/minify/vendor/intervention/httpauth/LICENSE b/admin/survey/minify/vendor/intervention/httpauth/LICENSE new file mode 100644 index 0000000..6c8e43b --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT)
+
+Copyright (c) 2013 Oliver Vogel
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file diff --git a/admin/survey/minify/vendor/intervention/httpauth/README.md b/admin/survey/minify/vendor/intervention/httpauth/README.md new file mode 100644 index 0000000..f85b09b --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/README.md @@ -0,0 +1,102 @@ +# Intervention Httpauth Class
+
+Library to manage HTTP authentication with PHP. Includes ServiceProviders for easy Laravel integration.
+
+## Installation
+
+The easiest way to install this package is via [Composer](https://getcomposer.org/).
+
+Run Composer to install the package.
+
+ $ composer require intervention/httpauth
+
+The Httpauth class is built to work with the Laravel Framework. The integration is done in seconds.
+
+Open your Laravel config file `config/app.php` and add the following lines.
+
+In the `$providers` array add the service providers for this package.
+
+ 'providers' => array(
+
+ ...
+
+ Intervention\Httpauth\HttpauthServiceProvider::class
+
+ ),
+
+
+Add the facade of this package to the `$aliases` array.
+
+ 'aliases' => array(
+
+ ...
+
+ 'Httpauth' => Intervention\Httpauth\Facades\Httpauth::class
+
+ ),
+
+
+## Usage
+
+* Httpauth::__construct - Create new instance of Httpauth class
+* Httpauth::make - Creates new instance of Httpaccess with given config parameters
+* Httpauth::secure - Denies access for not-authenticated users
+
+### Configuration
+
+By default the authentication settings are fetched from `config/httpauth.php`. Please make sure to set your own options.
+
+If you are using Laravel 4, you can extract a configuration file to your app by running the following command:
+
+ $ php artisan config:publish intervention/httpauth
+
+After you published the configuration file for the package you can edit the local configuration file `app/config/packages/intervention/httpauth/httpauth.php`.
+
+Here's a short explanation of the configuration directives.
+
+**type** _string_
+
+ Set the authentication type. Choose between `basic` and `digest` for a more secure type.
+
+**realm** _string_
+
+ The name of the secure resource.
+
+**username** _string_
+
+ The name the user has to enter to login
+
+**password** _string_
+
+ Login password
+
+### Code example
+
+```php
+// create a new instance of Httpauth and call secure method
+$auth = new Intervention\Httpauth\Httpauth;
+$auth->secure();
+
+// You can change the user authentication settings in the config files
+// or change it at runtime like this
+$config = array('username' => 'admin', 'password' => '1234');
+$auth = new Intervention\Httpauth\Httpauth($config);
+$auth->secure();
+```
+
+
+### Code example (Laravel)
+
+```php
+// the most simple way to secure a url is to call the secure method from a route
+Httpauth::secure();
+
+// You can change the user authentication settings in the config files
+// or change it at runtime like this
+$config = array('username' => 'admin', 'password' => '1234');
+Httpauth::make($config)->secure();
+```
+
+## License
+
+Intervention Httpauth Class is licensed under the [MIT License](http://opensource.org/licenses/MIT).
diff --git a/admin/survey/minify/vendor/intervention/httpauth/composer.json b/admin/survey/minify/vendor/intervention/httpauth/composer.json new file mode 100644 index 0000000..1473284 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/composer.json @@ -0,0 +1,33 @@ +{
+ "name": "intervention/httpauth",
+ "description": "HTTP authentication (Basic & Digest) including ServiceProviders for easy Laravel integration",
+ "homepage": "https://github.com/Intervention/httpauth",
+ "keywords": ["authentication", "http", "laravel"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Oliver Vogel",
+ "email": "oliver@olivervogel.com",
+ "homepage": "http://olivervogel.com/"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "Intervention\\Httpauth\\": "src/Intervention/Httpauth"
+ }
+ },
+ "extra": {
+ "laravel": {
+ "providers": [
+ "Intervention\\Httpauth\\HttpauthServiceProvider"
+ ],
+ "aliases": {
+ "Httpauth": "Intervention\\Httpauth\\Facades\\Httpauth"
+ }
+ }
+ },
+ "minimum-stability": "stable"
+}
\ No newline at end of file diff --git a/admin/survey/minify/vendor/intervention/httpauth/phpunit.xml b/admin/survey/minify/vendor/intervention/httpauth/phpunit.xml new file mode 100644 index 0000000..71adedc --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/phpunit.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ bootstrap="vendor/autoload.php"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+>
+ <testsuites>
+ <testsuite name="Package Test Suite">
+ <directory suffix=".php">./tests/</directory>
+ </testsuite>
+ </testsuites>
+</phpunit>
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/BasicUser.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/BasicUser.php new file mode 100644 index 0000000..5d1112b --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/BasicUser.php @@ -0,0 +1,63 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+class BasicUser implements UserInterface
+{
+ /**
+ * The loginname of the user
+ *
+ * @var string
+ */
+ private $name;
+
+ /**
+ * The password of the user
+ *
+ * @var password
+ */
+ private $password;
+
+ /**
+ * Creates a new instance
+ */
+ public function __construct()
+ {
+ $this->parse();
+ }
+
+ /**
+ * Checks for valid username & password
+ *
+ * @param string $name
+ * @param string $password
+ * @return boolean
+ */
+ public function isValid($name, $password, $realm = null)
+ {
+ return ($name == $this->name) && ($password == $this->password);
+ }
+
+ /**
+ * Parses the User Information from server variables
+
+ * @return void
+ */
+ public function parse()
+ {
+ if(array_key_exists('PHP_AUTH_USER', $_SERVER)) { // mod_php
+
+ $this->name = $_SERVER['PHP_AUTH_USER'];
+ $this->password = array_key_exists('PHP_AUTH_PW', $_SERVER) ? $_SERVER['PHP_AUTH_PW'] : null;
+
+ } elseif(array_key_exists('HTTP_AUTHENTICATION', $_SERVER)) { // most other servers
+
+ if(strpos(strtolower($_SERVER['HTTP_AUTHENTICATION']), 'basic') === 0) {
+
+ $userdata = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHENTICATION'], 6)));
+ list($this->name, $this->password) = $userdata;
+
+ }
+ }
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/DigestUser.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/DigestUser.php new file mode 100644 index 0000000..b274904 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/DigestUser.php @@ -0,0 +1,134 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+class DigestUser implements UserInterface
+{
+ /**
+ * Nonce to discourage cryptanalysis
+ *
+ * @var string
+ */
+ private $nonce;
+
+ /**
+ * nc
+ * @var string
+ */
+ private $nc;
+
+ /**
+ * cnonce
+ * @var string
+ */
+ private $cnonce;
+
+ /**
+ * quality of protection
+ *
+ * @var string
+ */
+ private $qop;
+
+ /**
+ * Name of user
+ *
+ * @var string
+ */
+ private $username;
+
+ /**
+ * Requested uri
+ *
+ * @var string
+ */
+ private $uri;
+
+ /**
+ * Response
+ *
+ * @var string
+ */
+ private $response;
+
+ /**
+ * Creates a new instance
+ */
+ public function __construct()
+ {
+ $this->parse();
+ }
+
+ /**
+ * Checks for valid username & password
+ *
+ * @param string $name
+ * @param string $password
+ * @return boolean
+ */
+ public function isValid($name, $password, $realm)
+ {
+ $request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET';
+ $u1 = md5(sprintf('%s:%s:%s', $this->username, $realm, $password));
+ $u2 = md5(sprintf('%s:%s', $request_method, $this->uri));
+ $response = md5(sprintf('%s:%s:%s:%s:%s:%s', $u1, $this->nonce, $this->nc, $this->cnonce, $this->qop, $u2));
+
+ return ($response == $this->response) && ($name == $this->username);
+ }
+
+ /**
+ * Parses the User Information from server variables
+
+ * @return void
+ */
+ public function parse()
+ {
+ $digest = $this->getDigest();
+ $user = array();
+ $required = array('nonce' => 1, 'nc' => 1, 'cnonce' => 1, 'qop' => 1, 'username' => 1, 'uri' => 1, 'response' => 1);
+
+ preg_match_all('@(\w+)=(?:(?:")([^"]+)"|([^\s,$]+))@', $digest, $matches, PREG_SET_ORDER);
+
+ if (is_array($matches)) {
+ foreach ($matches as $m) {
+ $key = $m[1];
+ $user[$key] = $m[2] ? $m[2] : $m[3];
+ unset($required[$key]);
+ }
+
+ if (count($required) == 0) {
+ $this->nonce = $user['nonce'];
+ $this->nc = $user['nc'];
+ $this->cnonce = $user['cnonce'];
+ $this->qop = $user['qop'];
+ $this->username = $user['username'];
+ $this->uri = $user['uri'];
+ $this->response = $user['response'];
+ }
+ }
+ }
+
+ /**
+ * Fetch digest data from environment information
+ *
+ * @return string
+ */
+ public function getDigest()
+ {
+ $digest = null;
+
+ if (isset($_SERVER['PHP_AUTH_DIGEST'])) {
+
+ $digest = $_SERVER['PHP_AUTH_DIGEST'];
+
+ } elseif (isset($_SERVER['HTTP_AUTHORIZATION'])) {
+
+ if (strpos(strtolower($_SERVER['HTTP_AUTHORIZATION']), 'digest') === 0) {
+
+ $digest = substr($_SERVER['HTTP_AUTHORIZATION'], 7);
+ }
+ }
+
+ return $digest;
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/Facades/Httpauth.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/Facades/Httpauth.php new file mode 100644 index 0000000..93cf2bd --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/Facades/Httpauth.php @@ -0,0 +1,13 @@ +<?php
+
+namespace Intervention\Httpauth\Facades;
+
+use Illuminate\Support\Facades\Facade;
+
+class Httpauth extends Facade
+{
+ protected static function getFacadeAccessor()
+ {
+ return 'httpauth';
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/Httpauth.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/Httpauth.php new file mode 100644 index 0000000..8a0c5a5 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/Httpauth.php @@ -0,0 +1,159 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+use Exception;
+
+class Httpauth
+{
+ /**
+ * Type of HTTP Authentication
+ *
+ * @var string
+ */
+ public $type = 'basic';
+
+ /**
+ * Realm of HTTP Authentication
+ *
+ * @var string
+ */
+ public $realm = 'Secured resource';
+
+ /**
+ * Username of HTTP Authentication
+ *
+ * @var string
+ */
+ private $username;
+
+ /**
+ * Password of HTTP Authentication
+ *
+ * @var string
+ */
+ private $password;
+
+ /**
+ * Creates new instance of Httpauth
+ *
+ * @param array $parameters set realm, username and/or password as key
+ */
+
+ public function __construct($parameters = null)
+ {
+ // overwrite settings with runtime parameters (optional)
+ if (is_array($parameters)) {
+
+ if (array_key_exists('type', $parameters)) {
+ $this->type = $parameters['type'];
+ }
+
+ if (array_key_exists('realm', $parameters)) {
+ $this->realm = $parameters['realm'];
+ }
+
+ if (array_key_exists('username', $parameters)) {
+ $this->username = $parameters['username'];
+ }
+
+ if (array_key_exists('password', $parameters)) {
+ $this->password = $parameters['password'];
+ }
+ }
+
+ // check if at leat username and password is set
+ if ( ! $this->username || ! $this->password) {
+ throw new Exception('No username or password set for HttpAuthentication.');
+ }
+ }
+
+ /**
+ * Creates new instance of Httpaccess with given parameters
+ *
+ * @param array $parameters set realm, username and/or password
+ * @return Intervention\Httpauth\Httpauth
+ */
+ public static function make($parameters = null)
+ {
+ return new Httpauth($parameters);
+ }
+
+ /**
+ * Denies access for not-authenticated users
+ *
+ * @return void
+ */
+ public function secure()
+ {
+ if ( ! $this->validateUser($this->getUser())) {
+ $this->denyAccess();
+ }
+ }
+
+ /**
+ * Checks for valid user
+ *
+ * @param User $user
+ * @return bool
+ */
+ private function validateUser(UserInterface $user)
+ {
+ return $user->isValid($this->username, $this->password, $this->realm);
+ }
+
+ /**
+ * Checks if username/password combination matches
+ *
+ * @param string $username
+ * @param string $password
+ * @return boolean
+ */
+ public function isValid($username, $password)
+ {
+ return ($username == $this->username) && ($password == $this->password);
+ }
+
+ /**
+ * Sends HTTP 401 Header
+ *
+ * @return void
+ */
+ private function denyAccess()
+ {
+ header('HTTP/1.0 401 Unauthorized');
+
+ switch (strtolower($this->type)) {
+
+ case 'digest':
+ header('WWW-Authenticate: Digest realm="' . $this->realm .'",qop="auth",nonce="' . uniqid() . '",opaque="' . md5($this->realm) . '"');
+ break;
+
+ default:
+ header('WWW-Authenticate: Basic realm="'.$this->realm.'"');
+ break;
+ }
+
+ die('<strong>HTTP/1.0 401 Unauthorized</strong>');
+ }
+
+ /**
+ * Get User according to current auth type
+ *
+ * @return Intervention\Httpauth\UserInterface
+ */
+ private function getUser()
+ {
+ // set user based on authentication type
+ switch (strtolower($this->type)) {
+
+ case 'digest':
+ return new DigestUser;
+ break;
+
+ default:
+ return new BasicUser;
+ break;
+ }
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProvider.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProvider.php new file mode 100644 index 0000000..0d7a988 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProvider.php @@ -0,0 +1,82 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+use Illuminate\Support\ServiceProvider;
+
+class HttpauthServiceProvider extends ServiceProvider
+{
+ /**
+ * Indicates if loading of the provider is deferred.
+ *
+ * @var bool
+ */
+ protected $defer = false;
+
+ /**
+ * Actual provider
+ *
+ * @var \Illuminate\Support\ServiceProvider
+ */
+ protected $provider;
+
+ /**
+ * Create a new service provider instance.
+ *
+ * @param \Illuminate\Contracts\Foundation\Application $app
+ * @return void
+ */
+ public function __construct($app)
+ {
+ parent::__construct($app);
+
+ $this->provider = $this->getProvider();
+ }
+
+ /**
+ * Return ServiceProvider according to Laravel version
+ *
+ * @return \Intervention\Httpauth\Provider\ProviderInterface
+ */
+ private function getProvider()
+ {
+ $app = $this->app;
+ $version = intval($app::VERSION);
+ $provider = sprintf(
+ '\Intervention\Httpauth\HttpauthServiceProviderLaravel%d', $version
+ );
+
+ return new $provider($app);
+ }
+
+ /**
+ * Bootstrap the application events.
+ *
+ * @return void
+ */
+ public function boot()
+ {
+ return $this->provider->boot();
+ }
+
+ /**
+ * Register the service provider.
+ *
+ * @return void
+ */
+ public function register()
+ {
+ return $this->provider->register();
+ }
+
+ /**
+ * Get the services provided by the provider.
+ *
+ * @return array
+ */
+ public function provides()
+ {
+ return array('httpauth');
+ }
+
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php new file mode 100644 index 0000000..31732b0 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php @@ -0,0 +1,30 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+use Illuminate\Support\ServiceProvider;
+
+class HttpauthServiceProviderLaravel4 extends ServiceProvider
+{
+ /**
+ * Bootstrap the application events.
+ *
+ * @return void
+ */
+ public function boot()
+ {
+ $this->package('intervention/httpauth');
+ }
+
+ /**
+ * Register the service provider.
+ *
+ * @return void
+ */
+ public function register()
+ {
+ $this->app['httpauth'] = $this->app->share(function($app) {
+ return new Httpauth($app['config']->get('httpauth::config'));
+ });
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php new file mode 100644 index 0000000..e19eee5 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php @@ -0,0 +1,37 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+use Illuminate\Support\ServiceProvider;
+
+class HttpauthServiceProviderLaravel5 extends ServiceProvider
+{
+ /**
+ * Bootstrap the application events.
+ *
+ * @return void
+ */
+ public function boot()
+ {
+ $this->publishes(array(
+ __DIR__.'/../../config/config.php' => config_path('httpauth.php')
+ ));
+ }
+
+ /**
+ * Register the service provider.
+ *
+ * @return void
+ */
+ public function register()
+ {
+ // merge default config
+ $this->mergeConfigFrom(
+ __DIR__.'/../../config/config.php', 'httpauth'
+ );
+
+ $this->app->singleton('httpauth', function ($app) {
+ return new Httpauth($app['config']->get('httpauth'));
+ });
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/UserInterface.php b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/UserInterface.php new file mode 100644 index 0000000..e2bfd8f --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/Intervention/Httpauth/UserInterface.php @@ -0,0 +1,22 @@ +<?php
+
+namespace Intervention\Httpauth;
+
+interface UserInterface
+{
+ /**
+ * Checks for valid username & password
+ *
+ * @param array $credentials
+ * @return boolean
+ */
+ public function isValid($name, $password, $realm);
+
+ /**
+ * Parses the User Information from server variables
+
+ * @return void
+ */
+ public function parse();
+
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/config/.gitkeep b/admin/survey/minify/vendor/intervention/httpauth/src/config/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/config/.gitkeep diff --git a/admin/survey/minify/vendor/intervention/httpauth/src/config/config.php b/admin/survey/minify/vendor/intervention/httpauth/src/config/config.php new file mode 100644 index 0000000..0655eab --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/src/config/config.php @@ -0,0 +1,49 @@ +<?php
+
+return array(
+
+ /*
+ |--------------------------------------------------------------------------
+ | Authentication type
+ |--------------------------------------------------------------------------
+ |
+ | Intervention Httpauth supports "basic" and "digest" authentication
+ | implementations. "Basic" is the simplest technique, while "Digest" applies
+ | hash functions to the password before sending it over the network.
+ |
+ | Supported: "basic", "digest"
+ |
+ */
+ 'type' => 'basic',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Authentication realm
+ |--------------------------------------------------------------------------
+ |
+ | Clients must authenticate itself to each realm.
+ |
+ */
+ 'realm' => 'Secured',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Authentication username
+ |--------------------------------------------------------------------------
+ |
+ | Username to access the secured realm in combination with a password.
+ |
+ */
+ 'username' => 'admin',
+
+ /*
+ |--------------------------------------------------------------------------
+ | Password
+ |--------------------------------------------------------------------------
+ |
+ | Password to access the secured realm in combination with the username.
+ |
+ */
+ 'password' => '1234'
+
+);
diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/.gitkeep b/admin/survey/minify/vendor/intervention/httpauth/tests/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/.gitkeep diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/BasicUserTest.php b/admin/survey/minify/vendor/intervention/httpauth/tests/BasicUserTest.php new file mode 100644 index 0000000..837a70e --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/BasicUserTest.php @@ -0,0 +1,30 @@ +<?php
+
+use Intervention\Httpauth\BasicUser;
+
+class BasicUserTest extends PHPUnit_Framework_TestCase
+{
+ public function testBasicUserAuthMod()
+ {
+ $_SERVER['PHP_AUTH_USER'] = 'test_user';
+ $_SERVER['PHP_AUTH_PW'] = 'test_password';
+
+ $user = new BasicUser;
+ $this->assertTrue($user->isValid('test_user', 'test_password'));
+ }
+
+ public function testUserAuth()
+ {
+ $userdata = array('test_user', 'test_password');
+ $userdata = implode(':', $userdata);
+ $userdata = base64_encode($userdata);
+ $userdata = 'basic_'.$userdata;
+
+ unset($_SERVER['PHP_AUTH_USER']);
+ unset($_SERVER['PHP_AUTH_PW']);
+ $_SERVER['HTTP_AUTHENTICATION'] = $userdata;
+
+ $user = new BasicUser;
+ $this->assertTrue($user->isValid('test_user', 'test_password'));
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/DigestUserTest.php b/admin/survey/minify/vendor/intervention/httpauth/tests/DigestUserTest.php new file mode 100644 index 0000000..7427794 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/DigestUserTest.php @@ -0,0 +1,12 @@ +<?php
+
+use Intervention\Httpauth\DigestUser;
+
+class DigestUserTest extends PHPUnit_Framework_TestCase
+{
+ public function testDigestUserCreation()
+ {
+ $user = new DigestUser;
+ $this->assertInstanceOf('\Intervention\Httpauth\DigestUser', $user);
+ }
+}
diff --git a/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php b/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php new file mode 100644 index 0000000..88230d5 --- /dev/null +++ b/admin/survey/minify/vendor/intervention/httpauth/tests/HttpauthTest.php @@ -0,0 +1,49 @@ +<?php
+
+use Intervention\Httpauth\Httpauth;
+
+class HttpauthTest extends PHPUnit_Framework_TestCase
+{
+ private function createTestHttpauth()
+ {
+ $config = array(
+ 'realm' => 'test_realm',
+ 'username' => 'test_user',
+ 'password' => 'test_password'
+ );
+
+ $httpauth = new Httpauth($config);
+ return $httpauth;
+ }
+
+ public function testConstruction()
+ {
+ $httpauth = $this->createTestHttpauth();
+ $this->assertInstanceOf('\Intervention\Httpauth\Httpauth', $httpauth);
+ $this->assertEquals('test_realm', $httpauth->realm);
+ $this->assertTrue($httpauth->isValid('test_user', 'test_password'));
+ }
+
+ public function testStaticCall()
+ {
+ $config = array(
+ 'realm' => '1',
+ 'username' => '2',
+ 'password' => '3'
+ );
+
+ $httpauth = Httpauth::make($config);
+
+ $this->assertInstanceOf('\Intervention\Httpauth\Httpauth', $httpauth);
+ $this->assertEquals('1', $httpauth->realm);
+ $this->assertTrue($httpauth->isValid($config['username'], $config['password']));
+ }
+
+ /**
+ * @expectedException Exception
+ */
+ public function testConstructorWithoutUserPassword()
+ {
+ $httpauth = new Httpauth;
+ }
+}
|