Skip to content

Is throwing expected claim "${claim}" in "${sourceName}" the correct behaviour on missing source? #197

@seybsen

Description

@seybsen

An error expected claim "${claim}" in "${sourceName}" is thrown if distributed sources do not return all claims referenced in _claim_names:
https://github.com/panva/node-openid-client/blob/master/lib/client.js#L55

Example:

{
	"sub": "dxu....",
	"_claim_names": {
		"address": "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab",
		"gender": "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab",
		"phone_number": "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab",
		"given_name": "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab",
		"family_name": "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab",
		"email": "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab"
	},
	"_claim_sources": {
		"55eb6148-9ddf-4f2d-98a6-30cbae6ebbab": {
			"access_token": "eyJraW...",
			"endpoint": "https://api-identity.example.com/userinfo"
		}
	}
}

when fetching the distributed claims gender is missing:

{
	"aud": "d7466ksfdzdxq",
	"sub": "dxu....",
	"id4me.identifier": "test.example.com",
	"id4me.identity": "test.example.com",
	"nbf": 1571127548,
	"address": {
		"street_address": "",
		"country": "",
		"formatted": "",
		"locality": "",
		"region": "",
		"postal_code": ""
	},
	"iss": "https://api-identity.example.com",
	"exp": 1571127578,
	"given_name": "Tester",
	"iat": 1571127548,
	"family_name": "Test",
	"email": "tester@example.com"
}

which then throws RPError: expected claim "gender" in "55eb6148-9ddf-4f2d-98a6-30cbae6ebbab"

Is this the correct behaviour according to RFC?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions