{"action":"opened","issue":{"url":"https://api.github.com/repos/rohe/pyoidc/issues/209","repository_url":"https://api.github.com/repos/rohe/pyoidc","labels_url":"https://api.github.com/repos/rohe/pyoidc/issues/209/labels{/name}","comments_url":"https://api.github.com/repos/rohe/pyoidc/issues/209/comments","events_url":"https://api.github.com/repos/rohe/pyoidc/issues/209/events","html_url":"https://github.com/rohe/pyoidc/issues/209","id":159173164,"number":209,"title":"PyOIDC is unable to return empty strings as id token claims","user":{"login":"bjmc","id":328557,"avatar_url":"https://avatars.githubusercontent.com/u/328557?v=3","gravatar_id":"","url":"https://api.github.com/users/bjmc","html_url":"https://github.com/bjmc","followers_url":"https://api.github.com/users/bjmc/followers","following_url":"https://api.github.com/users/bjmc/following{/other_user}","gists_url":"https://api.github.com/users/bjmc/gists{/gist_id}","starred_url":"https://api.github.com/users/bjmc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bjmc/subscriptions","organizations_url":"https://api.github.com/users/bjmc/orgs","repos_url":"https://api.github.com/users/bjmc/repos","events_url":"https://api.github.com/users/bjmc/events{/privacy}","received_events_url":"https://api.github.com/users/bjmc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-08T14:10:03Z","updated_at":"2016-06-08T14:10:03Z","closed_at":null,"body":"If the users DB returns an empty string for a particular claim (in our case, it was `middle_name`) that field will be omitted from id_token, even if it was requested in the `claims` parameter and is returned correctly for other users with non-empty middle names.\r\n\r\nThe `make_id_token()` function [instantiates an IdToken object](https://github.com/rohe/pyoidc/blob/a895609840c50c7b0b3026f837260fbba5e10a0c/src/oic/oic/__init__.py#L1534) and passes in the userinfo as keyword arguments. \r\n\r\n`IdToken` is a subclass of `oic.oauth2.message.Message` and the parent constructor calls  `Message.from_dict()` on `kwargs`, but [`from_dict()` discards any items with empty string values.](https://github.com/rohe/pyoidc/blob/a895609840c50c7b0b3026f837260fbba5e10a0c/src/oic/oauth2/message.py#L334)\r\n\r\nI don't know if that behavior is necessary or desirable on other subclasses of `Message`, but it seems wrong (or at least surprising) in the case of `IdToken`.\r\n\r\nThe [OpenIDConnect spec says](http://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse):\r\n\r\n> If a Claim is not returned, that Claim Name SHOULD be omitted from the JSON object representing the Claims; it SHOULD NOT be present with a null or empty string value.\r\n\r\nThere's room for interpretation, but I think this is the inverse scenario: If the OIDC server *is* generally returning that claim, then for users where the value of that claim is '', we SHOULD include the Claim Name, not omit it from the response."}}
{"actor":{"display_login":"bjmc"}}