{"action":"created","issue":{"url":"https://api.github.com/repos/coreos/go-oidc/issues/38","labels_url":"https://api.github.com/repos/coreos/go-oidc/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/coreos/go-oidc/issues/38/comments","events_url":"https://api.github.com/repos/coreos/go-oidc/issues/38/events","html_url":"https://github.com/coreos/go-oidc/pull/38","id":124300578,"number":38,"title":"oidc: update client metadata to dynamic registration spec","user":{"login":"ericchiang","id":2342749,"avatar_url":"https://avatars.githubusercontent.com/u/2342749?v=3","gravatar_id":"","url":"https://api.github.com/users/ericchiang","html_url":"https://github.com/ericchiang","followers_url":"https://api.github.com/users/ericchiang/followers","following_url":"https://api.github.com/users/ericchiang/following{/other_user}","gists_url":"https://api.github.com/users/ericchiang/gists{/gist_id}","starred_url":"https://api.github.com/users/ericchiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericchiang/subscriptions","organizations_url":"https://api.github.com/users/ericchiang/orgs","repos_url":"https://api.github.com/users/ericchiang/repos","events_url":"https://api.github.com/users/ericchiang/events{/privacy}","received_events_url":"https://api.github.com/users/ericchiang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-30T03:45:15Z","updated_at":"2015-12-30T17:13:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/coreos/go-oidc/pulls/38","html_url":"https://github.com/coreos/go-oidc/pull/38","diff_url":"https://github.com/coreos/go-oidc/pull/38.diff","patch_url":"https://github.com/coreos/go-oidc/pull/38.patch"},"body":"Update this package to hold structs required for dynamic client registration. ClientMetadata and ClientRegistrationResponse.\r\n\r\nThis commit is breaking. It updates ClientMetadata to be JSON compatible with the spec by\r\n  1. renaming `RedirectURLs` to `RedirectURIs` as per [the spec](http://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata)\r\n  2. changing that field's type from `[]url.URL` to `[]string` for JSON serialization \r\n\r\nThe tests affected by this change have been rectified. We will have to make a few changes to dex when updating this package (which we'll have to anyway to store the added fields in the client metadata).\r\n\r\n@bobbyrullo I don't know if this will fly, but I'd like to get your feedback nonetheless. Would it be better to keep `RedirectURLs` and list it deprecated?"},"comment":{"url":"https://api.github.com/repos/coreos/go-oidc/issues/comments/168036890","html_url":"https://github.com/coreos/go-oidc/pull/38#issuecomment-168036890","issue_url":"https://api.github.com/repos/coreos/go-oidc/issues/38","id":168036890,"user":{"login":"ericchiang","id":2342749,"avatar_url":"https://avatars.githubusercontent.com/u/2342749?v=3","gravatar_id":"","url":"https://api.github.com/users/ericchiang","html_url":"https://github.com/ericchiang","followers_url":"https://api.github.com/users/ericchiang/followers","following_url":"https://api.github.com/users/ericchiang/following{/other_user}","gists_url":"https://api.github.com/users/ericchiang/gists{/gist_id}","starred_url":"https://api.github.com/users/ericchiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericchiang/subscriptions","organizations_url":"https://api.github.com/users/ericchiang/orgs","repos_url":"https://api.github.com/users/ericchiang/repos","events_url":"https://api.github.com/users/ericchiang/events{/privacy}","received_events_url":"https://api.github.com/users/ericchiang/received_events","type":"User","site_admin":false},"created_at":"2015-12-30T17:13:56Z","updated_at":"2015-12-30T17:13:56Z","body":"Additionally considerations: Since we store client metadata as text in dex, this change should be negligible on the database side.\r\n\r\nStoring it [here](https://github.com/coreos/dex/blob/7c8e25f2923e71b9736c14abdf25c9acb69c9984/db/client.go#L46-L64) becomes more trivial.\r\n\r\n```diff\r\ndiff --git a/db/client.go b/db/client.go\r\nindex 89a1667..b5c7f22 100644\r\n--- a/db/client.go\r\n+++ b/db/client.go\r\n@@ -49,7 +49,7 @@ func newClientIdentityModel(id string, secret []byte, meta *oidc.ClientMetadata)\r\n                return nil, err\r\n        }\r\n \r\n-       bmeta, err := json.Marshal(newClientMetadataJSON(meta))\r\n+       bmeta, err := json.Marshal(meta)\r\n        if err != nil {\r\n                return nil, err\r\n        }\r\n``` \r\n\r\nMaintaining backwards compatibility in unmarshaling [here](https://github.com/coreos/dex/blob/7c8e25f2923e71b9736c14abdf25c9acb69c9984/db/client.go#L85-L103) is also fairly easy (though might pose issues for rolling updates).\r\n\r\n```diff\r\n$ git diff\r\ndiff --git a/db/client.go b/db/client.go\r\nindex 89a1667..33b7df9 100644\r\n--- a/db/client.go\r\n+++ b/db/client.go\r\n@@ -84,22 +83,14 @@ func newClientMetadataJSON(cm *oidc.ClientMetadata) *clientMetadataJSON {\r\n \r\n type clientMetadataJSON struct {\r\n        RedirectURLs []string `json:\"redirectURLs\"`\r\n+       *oidc.ClientMetadata\r\n }\r\n \r\n func (cmj clientMetadataJSON) ClientMetadata() (*oidc.ClientMetadata, error) {\r\n-       cm := oidc.ClientMetadata{\r\n-               RedirectURLs: make([]url.URL, len(cmj.RedirectURLs)),\r\n+       if len(cmj.RedirectURLs) > 0 {\r\n+               cmd.ClientMetadata.RedirectURIs = cmj.RedirectURLs\r\n        }\r\n-\r\n-       for i, us := range cmj.RedirectURLs {\r\n-               up, err := url.Parse(us)\r\n-               if err != nil {\r\n-                       return nil, err\r\n-               }\r\n-               cm.RedirectURLs[i] = *up\r\n-       }\r\n-\r\n-       return &cm, nil\r\n+       return cmd.ClientMetadata.RedirectURIs, nil\r\n }\r\n```"}}