CoreFiles by mySites.guru
JWELoaderFactory.php43 lines, 1,609 bytes, from Joomla_5.2.0-beta1-Beta-Full_Package.zip
Raw History Compare with 5.1.0-beta2
md5
6c04efb390ab5f3e49dc2da15a71aa05
sha1
0e4b9d3941f51a503393038e40a03d35c2f576a3
sha256
7ca2a22b21e883a943c34b6c29cf2f0cff31b2295bac1e7ba5bea86c1aca537b
<?php

declare(strict_types=1);

namespace Jose\Component\Encryption;

use Jose\Component\Checker\HeaderCheckerManagerFactory;
use Jose\Component\Encryption\Serializer\JWESerializerManagerFactory;

class JWELoaderFactory
{
    public function __construct(
        private readonly JWESerializerManagerFactory $jweSerializerManagerFactory,
        private readonly JWEDecrypterFactory $jweDecrypterFactory,
        private readonly ?HeaderCheckerManagerFactory $headerCheckerManagerFactory
    ) {
    }

    /**
     * Creates a JWELoader using the given serializer aliases, encryption algorithm aliases, compression method aliases
     * and header checker aliases.
     */
    public function create(
        array $serializers,
        array $encryptionAlgorithms,
        null|array $contentEncryptionAlgorithms = null,
        null|array $compressionMethods = null,
        array $headerCheckers = []
    ): JWELoader {
        if ($contentEncryptionAlgorithms !== null) {
            $encryptionAlgorithms = array_merge($encryptionAlgorithms, $contentEncryptionAlgorithms);
        }
        $serializerManager = $this->jweSerializerManagerFactory->create($serializers);
        $jweDecrypter = $this->jweDecrypterFactory->create($encryptionAlgorithms, null, $compressionMethods);
        if ($this->headerCheckerManagerFactory !== null) {
            $headerCheckerManager = $this->headerCheckerManagerFactory->create($headerCheckers);
        } else {
            $headerCheckerManager = null;
        }

        return new JWELoader($serializerManager, $jweDecrypter, $headerCheckerManager);
    }
}

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.