Closed damikael closed 2 years ago
It must be this way @damikael because the entity statement issued by a federation entity MUST be signed with its federation JWK (the kid in the head) and contains the public jwk of the descendant.
only the entity configuration of a leaf MUST have a matching kid in the alg of the public jwk contained in the statement
Ok @peppelinux, so the kid in the header of the JWS returned from the fetch endpoint should match with a key in the JWKS in the payload of federation entity statement (.well-known/openid-federation).
But the kid in the header from the fetch endpoint is:
"kid": "FifYx03bnosD8m6gYQIfNHNP9cM_Sam9Tc5nLloIIrc"
instead the JWKS returned from entity statement of federation is:
jwks": {
"keys": [
{
"kty": "RSA",
"n": "tXiKzIQA2mSCqbOzP2SyVKLKQs0b8z-2yEPJ0Sm3-nQAiGJp7BYfZi5xA3z_KyNQFrUb5QcV1W1cm-hDYHDKoKd3RJaYllQhHOktOL_1ZhrZjjBjOM1WkVYl6A9PuJ2T4YWBZu77DVZ-mOjlsLhG38ThavanGOiNpBkUBzATOMkWKcbLxBE5aXVfuFufn5fWyaNzs6NdSeA3Yy5OWfPPuzZsWoJdPzGP8jPzR294ocU0PcFzFWN0IpTQzvP6itB8WZqT8cH1l72IsjLQssJYbTefMBtcFGdeG4KRz1RoEaxeBcx1_Rlh84UmuJMM9BCWRCCGsyb1qhZUoT68gRSbyw",
"e": "AQAB",
"kid": "hR3XOruWxTATBtu0rlyOs_PXLRqKmBJrCckHfNWwvS0"
}
]
}
Ok, using the example project I got
and from http://127.0.0.1:8000/fetch/?sub=http://127.0.0.1:8000/oidc/rp/
I get this
eyJhbGciOiJSUzI1NiIsImtpZCI6IkZpZll4MDNibm9zRDhtNmdZUUlmTkhOUDljTV9TYW05VGM1bkxsb0lJcmMiLCJ0eXAiOiJlbnRpdHktc3RhdGVtZW50K2p3dCJ9.eyJleHAiOjE2NDg4OTgwOTgsImlhdCI6MTY0ODcyNTI5OCwiaXNzIjoiaHR0cDovLzEyNy4wLjAuMTo4MDAwLyIsInN1YiI6Imh0dHA6Ly8xMjcuMC4wLjE6ODAwMC9vaWRjL3JwLyIsImp3a3MiOnsia2V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J2NW1hT004TkNEcS01M3p3OW43OHdRQ2VIc1ViMTRHZWVzc05GZGMwcmI5Snd2X3lQTDBleTZ3bVBDRnZHOTQ4WmtNVXZHZ0t6SFFMWHBqUXZrSlpBcUVXaUw4b2trWkpNTndJWXB0R1o1d252RXdRIn1dfQ.Hq_66jMmFvREycrorQEGiT6I2HzYRaXXB3L6Gu61uUkKdVyTrUL6ncU2NEkCrqG7kiGH956m6_bCYTqQnVx23RhaOhn4Qa0quCue57eSNlCIcOqdAG9U6pWthJv0LP5MU49yhU0_OQ6M59zH3cWEHlDz6TeivpOe9blwCK5kGa9j_5lb62bVcDXuoKbPYUE2Gonx3YFGgwqhKzKx87nXUpXbKCXteE2edLbgclnk6GtOPKDU8ZHWdZwhDL5tJ3_eZjCbl79RxgHAlaLxPJ-kD5ZdXjFtlQFYww-QChXHKNiVNLTJ0i94pTmtGPkvlqM__BmyPvltHYlKPgT-BCPoGw
And I see
And what is the kid from federation entity statement, http://127.0.0.1:8000/.well-known/openid-federation ? In this we should have the key, with same kid, to verify the fetched jws. Is it right?
The fed entity signs a statement related to its descendants using its private JWK. The resulting statement is signed by fed entity (issuer), is related to the descendant (sub), contains in the header the KID of the fed entity and in the payload the jwks of the descendant.
In this way the fed entity signs the descendant jwks
Seems that the JWS returned from the fetch endpoint of the trust anchor is not properly signed. Infact the kid in the header is not present in the JKWS. Following is an example of json returned: