Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0939602c
Commit
0939602c
authored
Jun 30, 2017
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't accept delete tokens that are waiting to be reaped
parent
99200268
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
jwt.go
pkg/serviceaccount/jwt.go
+8
-0
No files found.
pkg/serviceaccount/jwt.go
View file @
0939602c
...
@@ -290,6 +290,10 @@ func (j *jwtTokenAuthenticator) AuthenticateToken(token string) (user.Info, bool
...
@@ -290,6 +290,10 @@ func (j *jwtTokenAuthenticator) AuthenticateToken(token string) (user.Info, bool
glog
.
V
(
4
)
.
Infof
(
"Could not retrieve token %s/%s for service account %s/%s: %v"
,
namespace
,
secretName
,
namespace
,
serviceAccountName
,
err
)
glog
.
V
(
4
)
.
Infof
(
"Could not retrieve token %s/%s for service account %s/%s: %v"
,
namespace
,
secretName
,
namespace
,
serviceAccountName
,
err
)
return
nil
,
false
,
errors
.
New
(
"Token has been invalidated"
)
return
nil
,
false
,
errors
.
New
(
"Token has been invalidated"
)
}
}
if
secret
.
DeletionTimestamp
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"Token is deleted and awaiting removal: %s/%s for service account %s/%s"
,
namespace
,
secretName
,
namespace
,
serviceAccountName
)
return
nil
,
false
,
errors
.
New
(
"Token has been invalidated"
)
}
if
bytes
.
Compare
(
secret
.
Data
[
v1
.
ServiceAccountTokenKey
],
[]
byte
(
token
))
!=
0
{
if
bytes
.
Compare
(
secret
.
Data
[
v1
.
ServiceAccountTokenKey
],
[]
byte
(
token
))
!=
0
{
glog
.
V
(
4
)
.
Infof
(
"Token contents no longer matches %s/%s for service account %s/%s"
,
namespace
,
secretName
,
namespace
,
serviceAccountName
)
glog
.
V
(
4
)
.
Infof
(
"Token contents no longer matches %s/%s for service account %s/%s"
,
namespace
,
secretName
,
namespace
,
serviceAccountName
)
return
nil
,
false
,
errors
.
New
(
"Token does not match server's copy"
)
return
nil
,
false
,
errors
.
New
(
"Token does not match server's copy"
)
...
@@ -301,6 +305,10 @@ func (j *jwtTokenAuthenticator) AuthenticateToken(token string) (user.Info, bool
...
@@ -301,6 +305,10 @@ func (j *jwtTokenAuthenticator) AuthenticateToken(token string) (user.Info, bool
glog
.
V
(
4
)
.
Infof
(
"Could not retrieve service account %s/%s: %v"
,
namespace
,
serviceAccountName
,
err
)
glog
.
V
(
4
)
.
Infof
(
"Could not retrieve service account %s/%s: %v"
,
namespace
,
serviceAccountName
,
err
)
return
nil
,
false
,
err
return
nil
,
false
,
err
}
}
if
serviceAccount
.
DeletionTimestamp
!=
nil
{
glog
.
V
(
4
)
.
Infof
(
"Service account has been deleted %s/%s"
,
namespace
,
serviceAccountName
)
return
nil
,
false
,
fmt
.
Errorf
(
"ServiceAccount %s/%s has been deleted"
,
namespace
,
serviceAccountName
)
}
if
string
(
serviceAccount
.
UID
)
!=
serviceAccountUID
{
if
string
(
serviceAccount
.
UID
)
!=
serviceAccountUID
{
glog
.
V
(
4
)
.
Infof
(
"Service account UID no longer matches %s/%s: %q != %q"
,
namespace
,
serviceAccountName
,
string
(
serviceAccount
.
UID
),
serviceAccountUID
)
glog
.
V
(
4
)
.
Infof
(
"Service account UID no longer matches %s/%s: %q != %q"
,
namespace
,
serviceAccountName
,
string
(
serviceAccount
.
UID
),
serviceAccountUID
)
return
nil
,
false
,
fmt
.
Errorf
(
"ServiceAccount UID (%s) does not match claim (%s)"
,
serviceAccount
.
UID
,
serviceAccountUID
)
return
nil
,
false
,
fmt
.
Errorf
(
"ServiceAccount UID (%s) does not match claim (%s)"
,
serviceAccount
.
UID
,
serviceAccountUID
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment