Preflight checklist
Ory Network Project
No response
Describe your problem
Current implementation of Signer interface and DefaultSigner code assumes that there is only one private key used by Fosite and based on that private key an RS256 or ES256 signature is made for all tokens. This is problematic because it is hard to support anything besides RS256. RS256 is mandated by the spec that it should always be supported so if you want to support also ES256 you have a problem - clients cannot opt-in into ES256.
Self-registration supports id_token_signed_response_alg for clients to select the signing algorithm.
This has been discussed by @vivshankar and @james-d-elliott in this issue as well. You can also see pains implementing this currently (one has to pass client data through ctx).
Describe your ideal solution
I think another interface should be implemented, ClientSigner maybe, which extends Signer with the following method:
GenerateForClient(ctx context.Context, client ClientSigner, claims MapClaims, header Mapper) (string, string, error)
ClientSigner is another interface which extends Client to add:
GetIdTokenSignedResponseAlg() string
GetUserInfoSignedResponseAlg() string
GetUserInfoSignedResponseAlg I added for future when #581 is made.
Then DefaultSigner should implement GenerateForClient and GenerateForClient should be used instead of Generate when available.
I am open to different approach to addressing this. The important thing is that fosite would have to accept RSA and ECDSA keys which would then use them to sign tokens as picked by the client.
Workarounds or alternatives
You can try to implement Signer interface yourself and pass client data through ctx.
Version
latest master
Additional Context
No response
Preflight checklist
Ory Network Project
No response
Describe your problem
Current implementation of
Signerinterface andDefaultSignercode assumes that there is only one private key used by Fosite and based on that private key an RS256 or ES256 signature is made for all tokens. This is problematic because it is hard to support anything besides RS256. RS256 is mandated by the spec that it should always be supported so if you want to support also ES256 you have a problem - clients cannot opt-in into ES256.Self-registration supports
id_token_signed_response_algfor clients to select the signing algorithm.This has been discussed by @vivshankar and @james-d-elliott in this issue as well. You can also see pains implementing this currently (one has to pass client data through
ctx).Describe your ideal solution
I think another interface should be implemented,
ClientSignermaybe, which extendsSignerwith the following method:ClientSigneris another interface which extendsClientto add:GetUserInfoSignedResponseAlgI added for future when #581 is made.Then
DefaultSignershould implementGenerateForClientandGenerateForClientshould be used instead ofGeneratewhen available.I am open to different approach to addressing this. The important thing is that fosite would have to accept RSA and ECDSA keys which would then use them to sign tokens as picked by the client.
Workarounds or alternatives
You can try to implement
Signerinterface yourself and pass client data throughctx.Version
latest master
Additional Context
No response