- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.188.218.103
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/puertode/public_html/tampico1900/apps/password_policy/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/puertode/public_html/tampico1900/apps/password_policy/lib/ComplianceService.php
<?php

declare(strict_types=1);
/**
 * @copyright Copyright (c) 2020 Arthur Schiwon <blizzz@arthur-schiwon.de>
 *
 * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
 *
 * @license GNU AGPL version 3 or any later version
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

namespace OCA\Password_Policy;

use OC\HintException;
use OC\User\LoginException;
use OCA\Password_Policy\Compliance\Expiration;
use OCA\Password_Policy\Compliance\HistoryCompliance;
use OCA\Password_Policy\Compliance\IAuditor;
use OCA\Password_Policy\Compliance\IEntryControl;
use OCA\Password_Policy\Compliance\IUpdatable;
use OCP\AppFramework\IAppContainer;
use OCP\AppFramework\QueryException;
use OCP\IConfig;
use OCP\ILogger;
use OCP\ISession;
use OCP\IUser;
use OCP\IUserSession;

class ComplianceService {
	/** @var IAppContainer */
	protected $container;
	/** @var ILogger */
	protected $logger;

	protected const COMPLIANCERS = [
		HistoryCompliance::class,
		Expiration::class,
	];
	/** @var IUserSession */
	private $userSession;
	/** @var IConfig */
	private $config;
	/** @var ISession */
	private $session;

	public function __construct(
		IAppContainer $container,
		ILogger $logger,
		IUserSession $userSession,
		IConfig $config,
		ISession $session
	) {
		$this->container = $container;
		$this->logger = $logger;
		$this->userSession = $userSession;
		$this->config = $config;
		$this->session = $session;
	}

	public function update(IUser $user, string $password) {
		foreach ($this->getInstance(IUpdatable::class) as $instance) {
			$instance->update($user, $password);
		}
	}

	public function audit(IUser $user, string $password) {
		foreach ($this->getInstance(IAuditor::class) as $instance) {
			$instance->audit($user, $password);
		}
	}

	/**
	 * @throws LoginException
	 */
	//public function entryControl(IUser $user, string $password, bool $isTokenLogin) {
	public function entryControl(string $loginName, string $password) {
		$uid = $loginName;
		\OCP\Util::emitHook('\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', ['uid' => &$uid]);
		foreach ($this->getInstance(IEntryControl::class) as $instance) {
			try {
				$user = \OC::$server->getUserManager()->get($uid);

				if (!($user instanceof IUser)) {
					break;
				}

				$instance->entryControl($user, $password);
			} catch (HintException $e) {
				throw new LoginException($e->getHint());
			}
		}
	}

	/**
	 * @returns Iterable
	 */
	protected function getInstance($interface) {
		foreach (self::COMPLIANCERS as $compliance) {
			try {
				$instance = $this->container->query($compliance);
				if (!$instance instanceof $interface) {
					continue;
				}
			} catch (QueryException $e) {
				//ignore and continue
				$this->logger->logException($e, ['level' => ILogger::INFO]);
				continue;
			}

			yield $instance;
		}
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit