In the PreviewController we are injecting IOptionsSnapshot<PreviewOptions> meaning it'll be created for each request. This meant that the default key used to sign the JWT was regenerated each time the controller was hit, and hence different when it's validated in the PreviewMiddleware
This PR moves the generation of the SigningCredentials to the AddPreview method instead and sets it on the options if no user SigningCredentials is set
In the
PreviewController
we are injectingIOptionsSnapshot<PreviewOptions>
meaning it'll be created for each request. This meant that the default key used to sign theJWT
was regenerated each time the controller was hit, and hence different when it's validated in thePreviewMiddleware
This PR moves the generation of the
SigningCredentials
to theAddPreview
method instead and sets it on the options if no userSigningCredentials
is set