|
9 | 9 | * @package SimpleSAMLphp |
10 | 10 | */ |
11 | 11 |
|
| 12 | +use SimpleSAML\Logger; |
| 13 | +use SimpleSAML\Utils\Attributes; |
| 14 | +use SimpleSAML\Utils\Crypto; |
12 | 15 | use Webmozart\Assert\Assert; |
13 | 16 | use WhiteHat101\Crypt\APR1_MD5; |
14 | 17 |
|
@@ -55,7 +58,7 @@ public function __construct($info, $config) |
55 | 58 | $this->users = explode("\n", trim($htpasswd)); |
56 | 59 |
|
57 | 60 | try { |
58 | | - $this->attributes = \SimpleSAML\Utils\Attributes::normalizeAttributesArray($config['static_attributes']); |
| 61 | + $this->attributes = Attributes::normalizeAttributesArray($config['static_attributes']); |
59 | 62 | } catch (\Exception $e) { |
60 | 63 | throw new \Exception('Invalid static_attributes in authentication source '. |
61 | 64 | $this->authId.': '.$e->getMessage()); |
@@ -93,23 +96,23 @@ protected function login($username, $password) |
93 | 96 | $attributes = array_merge(['uid' => [$username]], $this->attributes); |
94 | 97 |
|
95 | 98 | // Traditional crypt(3) |
96 | | - if (\SimpleSAML\Utils\Crypto::secureCompare($crypted, crypt($password, $crypted))) { |
97 | | - \SimpleSAML\Logger::debug('User '.$username.' authenticated successfully'); |
98 | | - \SimpleSAML\Logger::warning( |
| 99 | + if (Crypto::secureCompare($crypted, crypt($password, $crypted))) { |
| 100 | + Logger::debug('User '.$username.' authenticated successfully'); |
| 101 | + Logger::warning( |
99 | 102 | 'CRYPT authentication is insecure. Please consider using something else.' |
100 | 103 | ); |
101 | 104 | return $attributes; |
102 | 105 | } |
103 | 106 |
|
104 | 107 | // Apache's custom MD5 |
105 | 108 | if (APR1_MD5::check($password, $crypted)) { |
106 | | - \SimpleSAML\Logger::debug('User '.$username.' authenticated successfully'); |
| 109 | + Logger::debug('User '.$username.' authenticated successfully'); |
107 | 110 | return $attributes; |
108 | 111 | } |
109 | 112 |
|
110 | 113 | // PASSWORD_BCRYPT |
111 | | - if (\SimpleSAML\Utils\Crypto::pwValid($crypted, $password)) { |
112 | | - \SimpleSAML\Logger::debug('User '.$username.' authenticated successfully'); |
| 114 | + if (Crypto::pwValid($crypted, $password)) { |
| 115 | + Logger::debug('User '.$username.' authenticated successfully'); |
113 | 116 | return $attributes; |
114 | 117 | } |
115 | 118 | throw new \SimpleSAML\Error\Error('WRONGUSERPASS'); |
|
0 commit comments