Description
We are running the server in a docker environment with read-only filesystem and we use the same docker image for staging and production.
That's why we configure everything (including keys) using environment variables but this is impossible because the keys are required to be available as files :(
Furthermore you already accept the keys as content but in this case you write them to the filesystem (fails in my case because of r/o filesystem) just to get read again by Lcobucci\JWT\Signer\Key
.
Interestingly Lcobucci\JWT\Signer\Key
does accept the key content directly and only tries to read it as file if it starts with file://
.
As a simple test I have updated League\OAuth2\Server\CryptKey
constructor to just take the given key as is in case of matching RSA_KEY_PATTERN
and it worked fine for me.
... It's already a bit misleading that $keyPath
accepts key content (was the case before) but now getKeyPath()
also returns the key content in this case.
I would suggest to:
- Change it the way I described it
- rename constructor argument
$keyPath
to$key
and document it accepts both, a file path and key conent - deprecate
getKeyPath
- add new method
getKey()
documented as either key content or file path
- rename constructor argument
Thoughts?