Skip to content
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

revert method name change in xds server protocol for version compatibility #16195

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions agent/acl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type TestACLAgent struct {

// NewTestACLAgent does just enough so that all the code within agent/acl.go can work
// Basically it needs a local state for some of the vet* functions, a logger and a delegate.
// The key is that we are the delegate so we can control the ResolveTokenSecret responses
// The key is that we are the delegate so we can control the ResolveToken responses
func NewTestACLAgent(t *testing.T, name string, hcl string, resolveAuthz authzResolver, resolveIdent identResolver) *TestACLAgent {
t.Helper()

Expand Down Expand Up @@ -89,17 +89,17 @@ func NewTestACLAgent(t *testing.T, name string, hcl string, resolveAuthz authzRe
return a
}

func (a *TestACLAgent) ResolveTokenSecret(secretID string) (acl.Authorizer, error) {
func (a *TestACLAgent) ResolveToken(secretID string) (acl.Authorizer, error) {
if a.resolveAuthzFn == nil {
return nil, fmt.Errorf("ResolveTokenSecret call is unexpected - no authz resolver callback set")
return nil, fmt.Errorf("ResolveToken call is unexpected - no authz resolver callback set")
}

_, authz, err := a.resolveAuthzFn(secretID)
return authz, err
}

func (a *TestACLAgent) ResolveTokenAndDefaultMeta(secretID string, entMeta *acl.EnterpriseMeta, authzContext *acl.AuthorizerContext) (resolver.Result, error) {
authz, err := a.ResolveTokenSecret(secretID)
authz, err := a.ResolveToken(secretID)
if err != nil {
return resolver.Result{}, err
}
Expand Down
8 changes: 4 additions & 4 deletions agent/consul/acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,10 +993,10 @@ func (r *ACLResolver) resolveLocallyManagedToken(token string) (structs.ACLIdent
return r.resolveLocallyManagedEnterpriseToken(token)
}

// ResolveTokenSecret to an acl.Authorizer and structs.ACLIdentity. The acl.Authorizer
// ResolveToken to an acl.Authorizer and structs.ACLIdentity. The acl.Authorizer
// can be used to check permissions granted to the token using its secret, and the
// ACLIdentity describes the token and any defaults applied to it.
func (r *ACLResolver) ResolveTokenSecret(tokenSecretID string) (resolver.Result, error) {
func (r *ACLResolver) ResolveToken(tokenSecretID string) (resolver.Result, error) {
if !r.ACLsEnabled() {
return resolver.Result{Authorizer: acl.ManageAll()}, nil
}
Expand Down Expand Up @@ -1078,7 +1078,7 @@ func (r *ACLResolver) ResolveTokenAndDefaultMeta(
entMeta *acl.EnterpriseMeta,
authzContext *acl.AuthorizerContext,
) (resolver.Result, error) {
result, err := r.ResolveTokenSecret(tokenSecretID)
result, err := r.ResolveToken(tokenSecretID)
if err != nil {
return resolver.Result{}, err
}
Expand Down Expand Up @@ -1121,7 +1121,7 @@ func filterACLWithAuthorizer(logger hclog.Logger, authorizer acl.Authorizer, sub
// not authorized for read access will be removed from subj.
func filterACL(r *ACLResolver, tokenSecretID string, subj interface{}) error {
// Get the ACL from the token
authorizer, err := r.ResolveTokenSecret(tokenSecretID)
authorizer, err := r.ResolveToken(tokenSecretID)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions agent/consul/acl_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@ func (a *ACL) TokenBatchRead(args *structs.ACLTokenBatchGetRequest, reply *struc
return err
}

authz, err := a.srv.ResolveTokenSecret(args.Token)
authz, err := a.srv.ResolveToken(args.Token)
if err != nil {
return err
}
Expand Down Expand Up @@ -796,7 +796,7 @@ func (a *ACL) PolicyBatchRead(args *structs.ACLPolicyBatchGetRequest, reply *str
return err
}

authz, err := a.srv.ResolveTokenSecret(args.Token)
authz, err := a.srv.ResolveToken(args.Token)
if err != nil {
return err
}
Expand Down Expand Up @@ -1182,7 +1182,7 @@ func (a *ACL) RoleBatchRead(args *structs.ACLRoleBatchGetRequest, reply *structs
return err
}

authz, err := a.srv.ResolveTokenSecret(args.Token)
authz, err := a.srv.ResolveToken(args.Token)
if err != nil {
return err
}
Expand Down Expand Up @@ -2115,7 +2115,7 @@ func (a *ACL) Authorize(args *structs.RemoteACLAuthorizationRequest, reply *[]st
return err
}

authz, err := a.srv.ResolveTokenSecret(args.Token)
authz, err := a.srv.ResolveToken(args.Token)
if err != nil {
return err
}
Expand Down
Loading