-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
retrofit svcacct token authenticator to support audience validation #70157
Conversation
/assign @caesarxuchao |
/assign @liggitt |
73f4f70
to
ba9d89d
Compare
@awly fixed. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mikedanese The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
/retest |
@@ -170,14 +172,34 @@ func (j *jwtTokenAuthenticator) AuthenticateToken(ctx context.Context, tokenData | |||
return nil, false, utilerrors.NewAggregate(errlist) | |||
} | |||
|
|||
tokenAudiences := authenticator.Audiences(public.Audience) | |||
if len(tokenAudiences) == 0 { | |||
// only apiserver audiences are allowed for legacy tokens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment be // tokens with no audience (legacy tokens) implicitly have the apiserver audience.
|
||
requestedAudiences, ok := authenticator.AudiencesFrom(ctx) | ||
if !ok { | ||
// default to apiserver audiences |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// requests that don't explicitly request an audience are requesting the implicit apiserver audience.
requestedAudiences = j.implicitAuds | ||
} | ||
|
||
auds := authenticator.Audiences(tokenAudiences).Intersect(requestedAudiences) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchingAudiences := ...
? Up to you.
/kind feature
/sig auth
#69893
@kubernetes/sig-auth-pr-reviews