CoreFiles by mySites.guru
LdapBadge.php85 lines, 2,479 bytes, from Joomla_5.3.0-Stable-Full_Package.zip
Raw History Compare with 5.2.6
md5
32c81b5bb7f06ab7fd05cc6c490c2e6b
sha1
7a6de89915a9a68c5e4539383e714b33af472f16
sha256
7b67aa2a1a5e1f9058ae2d898bdb7bb9c193693777599ce434f9c185909a1a4f
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Ldap\Security;

use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface;

/**
 * A badge indicating that the credentials should be checked using LDAP.
 *
 * This badge must be used together with PasswordCredentials.
 *
 * @author Wouter de Jong <[email protected]>
 *
 * @final
 */
class LdapBadge implements BadgeInterface
{
    private bool $resolved = false;
    private string $ldapServiceId;
    private string $dnString;
    private string $searchDn;
    private string $searchPassword;
    private ?string $queryString;

    public function __construct(string $ldapServiceId, string $dnString = '{user_identifier}', string $searchDn = '', string $searchPassword = '', ?string $queryString = null)
    {
        $this->ldapServiceId = $ldapServiceId;
        $dnString = str_replace('{username}', '{user_identifier}', $dnString, $replaceCount);
        if ($replaceCount > 0) {
            trigger_deprecation('symfony/ldap', '6.2', 'Using "{username}" parameter in LDAP configuration is deprecated, consider using "{user_identifier}" instead.');
        }
        $this->dnString = $dnString;
        $this->searchDn = $searchDn;
        $this->searchPassword = $searchPassword;
        $queryString = str_replace('{username}', '{user_identifier}', $queryString ?? '', $replaceCount);
        if ($replaceCount > 0) {
            trigger_deprecation('symfony/ldap', '6.2', 'Using "{username}" parameter in LDAP configuration is deprecated, consider using "{user_identifier}" instead.');
        }
        $this->queryString = $queryString;
    }

    public function getLdapServiceId(): string
    {
        return $this->ldapServiceId;
    }

    public function getDnString(): string
    {
        return $this->dnString;
    }

    public function getSearchDn(): string
    {
        return $this->searchDn;
    }

    public function getSearchPassword(): string
    {
        return $this->searchPassword;
    }

    public function getQueryString(): ?string
    {
        return $this->queryString;
    }

    public function markResolved(): void
    {
        $this->resolved = true;
    }

    public function isResolved(): bool
    {
        return $this->resolved;
    }
}

The same content is in 87 releases, Joomla 5.1.0-beta1 to 6.0.0-alpha3. See them all, or every version of this file.