diff options
| author | chrislu <chris.lu@gmail.com> | 2022-09-14 23:06:44 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2022-09-14 23:06:44 -0700 |
| commit | 21c058790010aa9224568248f2d9bf9c324b6747 (patch) | |
| tree | ef2e2a1693c0563f8e44c099d1fee929f40863ff /weed/security | |
| parent | c8645fd2323d97164489e0429ed140f84002e61e (diff) | |
| download | seaweedfs-21c058790010aa9224568248f2d9bf9c324b6747.tar.xz seaweedfs-21c058790010aa9224568248f2d9bf9c324b6747.zip | |
go fmt
Diffstat (limited to 'weed/security')
| -rw-r--r-- | weed/security/guard.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/weed/security/guard.go b/weed/security/guard.go index 33927a924..14aacb83c 100644 --- a/weed/security/guard.go +++ b/weed/security/guard.go @@ -17,12 +17,12 @@ var ( /* Guard is to ensure data access security. There are 2 ways to check access: -1. white list. It's checking request ip address. -2. JSON Web Token(JWT) generated from secretKey. - The jwt can come from: - 1. url parameter jwt=... - 2. request header "Authorization" - 3. cookie with the name "jwt" + 1. white list. It's checking request ip address. + 2. JSON Web Token(JWT) generated from secretKey. + The jwt can come from: + 1. url parameter jwt=... + 2. request header "Authorization" + 3. cookie with the name "jwt" The white list is checked first because it is easy. Then the JWT is checked. @@ -32,13 +32,12 @@ The Guard will also check these claims if provided: 2. "nbf" Not Before Generating JWT: -1. use HS256 to sign -2. optionally set "exp", "nbf" fields, in Unix time, - the number of seconds elapsed since January 1, 1970 UTC. + 1. use HS256 to sign + 2. optionally set "exp", "nbf" fields, in Unix time, + the number of seconds elapsed since January 1, 1970 UTC. Referenced: https://github.com/pkieltyka/jwtauth/blob/master/jwtauth.go - */ type Guard struct { whiteList []string |
