/var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Auth
NameSizeModeActions
Storage/-0755rm
AbstractPasswordHasher.php23620644editdlrm
BaseAuthenticate.php91230644editdlrm
BaseAuthorize.php18840644editdlrm
BasicAuthenticate.php42090644editdlrm
ControllerAuthorize.php30260644editdlrm
DefaultPasswordHasher.php27400644editdlrm
DigestAuthenticate.php100570644editdlrm
FallbackPasswordHasher.php31690644editdlrm
FormAuthenticate.php31930644editdlrm
PasswordHasherFactory.php20350644editdlrm
WeakPasswordHasher.php19670644editdlrm
Edit: /var/www/vhosts/ihelp.ro/_OLD/vendor/cakephp/cakephp/src/Auth/BasicAuthenticate.php (4209B)
loadComponent('Auth', [ * 'authenticate' => ['Basic'] * 'storage' => 'Memory', * 'unauthorizedRedirect' => false, * ]); * ``` * * You should set `storage` to `Memory` to prevent CakePHP from sending a * session cookie to the client. * * You should set `unauthorizedRedirect` to `false`. This causes `AuthComponent` to * throw a `ForbiddenException` exception instead of redirecting to another page. * * Since HTTP Basic Authentication is stateless you don't need call `setUser()` * in your controller. The user credentials will be checked on each request. If * valid credentials are not provided, required authentication headers will be sent * by this authentication provider which triggers the login dialog in the browser/client. * * @see https://book.cakephp.org/4/en/controllers/components/authentication.html */ class BasicAuthenticate extends BaseAuthenticate { /** * Authenticate a user using HTTP auth. Will use the configured User model and attempt a * login using HTTP auth. * * @param \Cake\Http\ServerRequest $request The request to authenticate with. * @param \Cake\Http\Response $response The response to add headers to. * @return array|false Either false on failure, or an array of user data on success. */ public function authenticate(ServerRequest $request, Response $response) { return $this->getUser($request); } /** * Get a user based on information in the request. Used by cookie-less auth for stateless clients. * * @param \Cake\Http\ServerRequest $request Request object. * @return array|false Either false or an array of user information */ public function getUser(ServerRequest $request) { $username = $request->getEnv('PHP_AUTH_USER'); $pass = $request->getEnv('PHP_AUTH_PW'); if (!is_string($username) || $username === '' || !is_string($pass) || $pass === '') { return false; } return $this->_findUser($username, $pass); } /** * Handles an unauthenticated access attempt by sending appropriate login headers * * @param \Cake\Http\ServerRequest $request A request object. * @param \Cake\Http\Response $response A response object. * @return \Cake\Http\Response|null|void * @throws \Cake\Http\Exception\UnauthorizedException */ public function unauthenticated(ServerRequest $request, Response $response) { $unauthorizedException = new UnauthorizedException(); $unauthorizedException->responseHeader($this->loginHeaders($request)); throw $unauthorizedException; } /** * Generate the login headers * * @param \Cake\Http\ServerRequest $request Request object. * @return string[] Headers for logging in. */ public function loginHeaders(ServerRequest $request): array { $realm = $this->getConfig('realm') ?: $request->getEnv('SERVER_NAME'); return [ 'WWW-Authenticate' => sprintf('Basic realm="%s"', $realm), ]; } }