PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.7.0
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.7.0
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / intervention / httpauth / src / Token / HttpAuthentification.php

HttpAuthentification.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.7.0, at vendor/intervention/httpauth/src/Token/HttpAuthentification.php

49 lines 1022 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Intervention\HttpAuth\Token;
4
5 use Intervention\HttpAuth\Key;
6
7 class HttpAuthentification extends NullToken
8 {
9 /**
10 * Parsed authentification value
11 *
12 * @var string
13 */
14 protected $value;
15
16 /**
17 * Transform current instance to key object
18 *
19 * @return Key
20 */
21 public function toKey(): Key
22 {
23 list($username, $password) = explode(':', base64_decode(substr($this->value, 6)));
24
25 $key = new Key();
26 $key->setProperty('username', $username);
27 $key->setProperty('password', $password);
28
29 return $key;
30 }
31
32 /**
33 * Parse environment variables and store value in object
34 *
35 * @return bool "true" if value was found or "false"
36 */
37 protected function parse(): bool
38 {
39 $value = $this->getArrayValue($_SERVER, 'HTTP_AUTHENTICATION');
40 if (strtolower(substr($value, 0, 5)) === 'basic') {
41 $this->value = $value;
42
43 return true;
44 }
45
46 return false;
47 }
48 }
49