From a701219dba2319f0eb2372102f7878d5f5a21722 Mon Sep 17 00:00:00 2001 From: Youfu Zhang Date: Fri, 30 Aug 2024 11:41:11 +0800 Subject: [PATCH] fix: Option.TokenExpiration should be number of seconds instead of Unix timestamp close #6 --- README.md | 2 +- example/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e46241a..3e70b68 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ func main() { opt := ®istry.Option{ Certfile: crt, Keyfile: key, - TokenExpiration: time.Now().Add(24 * time.Hour).Unix(), // 24hrs + TokenExpiration: (24 * time.Hour).Milliseconds() / 1000, // 24hrs TokenIssuer: "Authz", Authenticator: &exampleAuthenticator{}, // could be nil, meaning all users would be authenticated by default } diff --git a/example/main.go b/example/main.go index 76b8b65..24ae2bb 100644 --- a/example/main.go +++ b/example/main.go @@ -14,7 +14,7 @@ func main() { opt := ®istry.Option{ Certfile: "/mnt/certs/RootCA.crt", Keyfile: "/mnt/certs/RootCA.key", - TokenExpiration: time.Now().Add(24 * time.Hour).Unix(), + TokenExpiration: (24 * time.Hour).Milliseconds() / 1000, TokenIssuer: "Authz", Authenticator: &httpAuthenticator{}, }