aboutsummaryrefslogtreecommitdiff
path: root/weed/security/guard.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-05-04 08:42:25 -0700
committerChris Lu <chris.lu@gmail.com>2019-05-04 08:42:25 -0700
commit25941e0500de02f539cc6629e549e7e0096cc2eb (patch)
tree5493651887f2244a4a731243c007e1bff60ecb33 /weed/security/guard.go
parentbd8af92b54ef73c7b9fd487db7d47993a0ae3002 (diff)
downloadseaweedfs-25941e0500de02f539cc6629e549e7e0096cc2eb.tar.xz
seaweedfs-25941e0500de02f539cc6629e549e7e0096cc2eb.zip
master: add jwt expires_after_seconds
Diffstat (limited to 'weed/security/guard.go')
-rw-r--r--weed/security/guard.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/weed/security/guard.go b/weed/security/guard.go
index 84a415253..d8427997e 100644
--- a/weed/security/guard.go
+++ b/weed/security/guard.go
@@ -41,14 +41,15 @@ https://github.com/pkieltyka/jwtauth/blob/master/jwtauth.go
*/
type Guard struct {
- whiteList []string
- SigningKey SigningKey
+ whiteList []string
+ SigningKey SigningKey
+ ExpiresAfterSec int
isActive bool
}
-func NewGuard(whiteList []string, signingKey string) *Guard {
- g := &Guard{whiteList: whiteList, SigningKey: SigningKey(signingKey)}
+func NewGuard(whiteList []string, signingKey string, expiresAfterSec int) *Guard {
+ g := &Guard{whiteList: whiteList, SigningKey: SigningKey(signingKey), ExpiresAfterSec:expiresAfterSec}
g.isActive = len(g.whiteList) != 0 || len(g.SigningKey) != 0
return g
}