CoreFiles by mySites.guru
JWEBuilderFactory.php53 lines, 2,094 bytes, from Joomla_5.2.2-Stable-Full_Package.zip
Raw History Compare with 5.2.1
md5
6b63e4354c101aca28af062ea02953e9
sha1
d5ede974e29f749c310958ded562d1a0e895e691
sha256
4ef5b103b7362b77462de3d40bff62234fb896263d52ddcf90b125c5c55d980e
<?php

declare(strict_types=1);

namespace Jose\Component\Encryption;

use Jose\Component\Core\AlgorithmManagerFactory;
use Jose\Component\Encryption\Compression\CompressionMethodManagerFactory;

class JWEBuilderFactory
{
    public function __construct(
        private readonly AlgorithmManagerFactory $algorithmManagerFactory,
        private readonly null|CompressionMethodManagerFactory $compressionMethodManagerFactory = null
    ) {
        if ($compressionMethodManagerFactory !== null) {
            trigger_deprecation(
                'web-token/jwt-library',
                '3.3.0',
                'The parameter "$compressionMethodManagerFactory" is deprecated and will be removed in 4.0.0. Compression is not recommended for JWE. Please set "null" instead.'
            );
        }
    }

    /**
     * Creates a JWE Builder object using the given key encryption algorithms, content encryption algorithms and
     * compression methods.
     *
     * @param array<string> $encryptionAlgorithms
     * @param null|array<string> $contentEncryptionAlgorithm
     * @param null|string[] $compressionMethods
     */
    public function create(
        array $encryptionAlgorithms,
        null|array $contentEncryptionAlgorithm = null,
        null|array $compressionMethods = null
    ): JWEBuilder {
        if ($contentEncryptionAlgorithm !== null) {
            trigger_deprecation(
                'web-token/jwt-library',
                '3.3.0',
                'The parameter "$contentEncryptionAlgorithm" is deprecated and will be removed in 4.0.0. Please set "null" instead.'
            );
            $encryptionAlgorithms = array_merge($encryptionAlgorithms, $contentEncryptionAlgorithm);
        }
        $encryptionAlgorithmManager = $this->algorithmManagerFactory->create($encryptionAlgorithms);
        $compressionMethodManager = $compressionMethods === null ? null : $this->compressionMethodManagerFactory?->create(
            $compressionMethods
        );

        return new JWEBuilder($encryptionAlgorithmManager, null, $compressionMethodManager);
    }
}

The same content is in 118 releases, Joomla 5.2.0-alpha2 to 6.2.1. See them all, or every version of this file.