distribution/registry
Marcus Martins db1bf93098
Add leeway to JWT nbf and exp checking
Adds a constant leeway (60 seconds) to the nbf and exp claim check to
account for clock skew between the registry servers and the
authentication server that generated the JWT.

The leeway of 60 seconds is a bit arbitrary but based on the RFC
recommendation and hub.docker.com logs/metrics where we don't see
drifts of more than a second on our servers running ntpd.

I didn't attempt to make the leeway configurable as it would add extra
complexity to the PR and I am not sure how Distribution prefer to
handle runtime flags like that.

Also, I am simplifying the exp and nbf check for readability as the
previous `NOT (A AND B)` with cmp operators was not very friendly.

Ref:
https://tools.ietf.org/html/rfc7519#section-4.1.5

Signed-off-by: Marcus Martins <marcus@docker.com>
2016-07-18 17:47:30 -07:00
..
api Enable URLs returned from the registry to be configured as relative. 2016-03-23 15:14:32 -07:00
auth Add leeway to JWT nbf and exp checking 2016-07-18 17:47:30 -07:00
client Merge pull request #1522 from RichardScothern/tag-events 2016-03-23 16:41:29 -07:00
handlers Ensure we log io.Copy errors and bytes copied/total in uploads 2016-04-04 17:21:36 -07:00
listener [Server] Listen and serve on a unix socket 2015-05-11 16:00:14 +03:00
middleware Add pull through cache functionality to the Registry which can be configured 2015-08-04 16:09:55 -07:00
proxy Merge pull request #1502 from RichardScothern/auth-url-endpoints 2016-03-14 16:28:24 -07:00
storage Merge pull request #1677 from RichardScothern/tonyhb-fix-s3-gc-error 2016-04-28 14:09:58 -07:00
doc.go Move initialization code from main.go to the registry package 2015-09-09 14:39:31 -07:00
registry.go Implements garbage collection subcommand 2016-02-29 14:15:21 -08:00
root.go Move garbage collect code into storage package 2016-04-27 13:34:25 -07:00