feat: adapt to dex and pass the 'keyauth' in payload instead of in id_token. Also have a different mapping for id_token claims name

pull/1671/head
beltram 1 year ago committed by Herman Slatman
parent af31a167c6
commit b6ec4422b4
No known key found for this signature in database
GPG Key ID: F4D8A44EA0A75A4F

@ -355,6 +355,8 @@ func dns01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSONWebK
type WireChallengePayload struct {
// IdToken
IdToken string `json:"id_token,omitempty"`
// KeyAuth ({challenge-token}.{jwk-thumbprint})
KeyAuth string `json:"keyauth,omitempty"`
// AccessToken is the token generated by wire-server
AccessToken string `json:"access_token,omitempty"`
}
@ -380,9 +382,8 @@ func wireOIDC01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSO
}
var claims struct {
Name string `json:"name"`
Handle string `json:"handle"`
KeyAuth string `json:"keyauth"`
Name string `json:"preferred_username"`
Handle string `json:"name"`
}
err = idToken.Claims(&claims)
if err != nil {
@ -399,9 +400,9 @@ func wireOIDC01Validate(ctx context.Context, ch *Challenge, db DB, jwk *jose.JSO
if err != nil {
return err
}
if expectedKeyAuth != claims.KeyAuth {
if expectedKeyAuth != wireChallengePayload.KeyAuth {
return storeError(ctx, db, ch, true, NewError(ErrorRejectedIdentifierType,
"keyAuthorization does not match; expected %s, but got %s", expectedKeyAuth, claims.KeyAuth))
"keyAuthorization does not match; expected %s, but got %s", expectedKeyAuth, wireChallengePayload.KeyAuth))
}
if challengeValues.Name != claims.Name || challengeValues.Handle != claims.Handle {

Loading…
Cancel
Save