File modules/cms/auth/HttpAuth.class.php

Last commit: Sun Nov 29 21:46:57 2020 +0100	Jan Dankert	Auth modules should only use the Auth::STATUS_* constants as return value.
1 <?php 2 3 namespace cms\auth; 4 5 use cms\auth\Auth; 6 use cms\base\Configuration; 7 use util\Http; 8 9 /** 10 * HTTP-Authentifzierung. 11 * 12 * Das vom Benutzer eingegebene Kennwort wird gegen eine HTTP-Adresse 13 * geprüft, bei der HTTP-Auth aktiviert ist. 14 * 15 * @author Jan Dankert 16 */ 17 class HttpAuth implements Auth 18 { 19 20 /** 21 * Dieses Loginmodul kann keinen Namen feststellen. 22 */ 23 public function username() 24 { 25 return null; 26 } 27 28 29 /** 30 * Ueberpruefen des Kennwortes. 31 * 32 * Das Kennwort wird gegen einen HTTP-Server geprüft. 33 */ 34 public function login($user, $password, $token) 35 { 36 $http = new Http( Configuration::get(['security','http','url'])); 37 $http->method = 'HEAD'; 38 $http->setBasicAuthentication($user, $password); 39 40 $ok = $http->request(); 41 42 return $ok ? Auth::STATUS_SUCCESS : Auth::STATUS_FAILED; 43 } 44 }
Download modules/cms/auth/HttpAuth.class.php
History Sun, 29 Nov 2020 21:46:57 +0100 Jan Dankert Auth modules should only use the Auth::STATUS_* constants as return value. Mon, 16 Nov 2020 13:21:57 +0100 Jan Dankert Code cleanup: Externalize calling the auth modules. Sun, 1 Nov 2020 03:08:55 +0100 Jan Dankert Replaced the calls to "Configuration::rawConfig()" with the OO style calls; Cleanup LoginAction. Sat, 26 Sep 2020 10:32:02 +0200 Jan Dankert Refactoring: No global $conf array any more. Sun, 23 Feb 2020 04:49:34 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 2. Sun, 23 Feb 2020 04:01:30 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 1: moving.