Skip to content

\Lcobucci\JWT\Configuration::forSymmetricSigner should set up validations. #950

Open
@SamMousa

Description

@SamMousa

When using a configuration object it makes sense to me to set up constraints when using helpers like forSymmetricSigner.

public static function forSymmetricSigner(
        Signer $signer,
        Key $key,
        ?Encoder $encoder = null,
        ?Decoder $decoder = null
    ): self {
        $result new self(
            $signer,
            $key,
            $key,
            $encoder,
            $decoder
        );
        $result->validationConstraints[] = new SignedWith($signer, $key);
        return $result;
    }

Of course this will then need to be kept in sync when someone calls setSigner later... So additional point: we should make Configuration immutable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions