func (s *Server) resolveToken(id string) (acl.ACL, error) {
	// Check if there is no ACL datacenter (ACLs disabled)
	authDC := s.config.ACLDatacenter
	if len(authDC) == 0 {
		return nil, nil
	}
	defer metrics.MeasureSince([]string{"consul", "acl", "resolveToken"}, time.Now())

	// Handle the anonymous token
	if len(id) == 0 {
		id = anonymousToken
	} else if acl.RootACL(id) != nil {
		return nil, errors.New(rootDenied)
	}

	// Check if we are the ACL datacenter and the leader, use the
	// authoritative cache
	if s.config.Datacenter == authDC && s.IsLeader() {
		return s.aclAuthCache.GetACL(id)
	}

	// Use our non-authoritative cache
	return s.aclCache.lookupACL(id, authDC)
}
// resolveToken is the primary interface used by ACL-checkers (such as an
// endpoint handling a request) to resolve a token. If ACLs aren't enabled
// then this will return a nil token, otherwise it will attempt to use local
// cache and ultimately the ACL datacenter to get the policy associated with the
// token.
resolveToken is the primary interface used by ACL-checkers (such as an
endpoint handling a request) to resolve a token. If ACLs aren't enabled
then this will return a nil token, otherwise it will attempt to use local
cache and ultimately the ACL datacenter to get the policy associated with the
token.
// resolveToken is the primary interface used by ACL - checkers ( such as an // endpoint handling a request ) to resolve a token . If ACLs aren ' t enabled // then this will return a nil token otherwise it will attempt to use local // cache and ultimately the ACL datacenter to get the policy associated with the // token .
func (s *Server) resolveToken(id string) (acl.ACL, error) {
	authDC := s.config.ACLDatacenter
	if len(authDC) == 0 {
		return nil, nil
	}
	defer metrics.MeasureSince([]string{"consul", "acl", "resolveToken"}, time.Now())
	if len(id) == 0 {
		id = anonymousToken
	} else if acl.RootACL(id) != nil {
		return nil, errors.New(rootDenied)
	}
	if s.config.Datacenter == authDC && s.IsLeader() {
		return s.aclAuthCache.GetACL(id)
	}
	return s.aclCache.lookupACL(id, authDC)
}
func ( s * Server ) resolveToken ( id string ) ( acl . ACL , error ) { authDC := s . config . ACLDatacenter if len ( authDC ) == 0 { return nil , nil } defer metrics . MeasureSince ( [ ] string { " " , " " , " " } , time . Now ( ) ) if len ( id ) == 0 { id = anonymousToken } else if acl . RootACL ( id ) != nil { return nil , errors . New ( rootDenied ) } if s . config . Datacenter == authDC && s . IsLeader ( ) { return s . aclAuthCache . GetACL ( id ) } return s . aclCache . lookupACL ( id , authDC ) }
resolveToken is the primary interface used by ACL-checkers (such as an
endpoint handling a request) to resolve a token.
resolveToken is the primary interface used by ACL - checkers ( such as an endpoint handling a request ) to resolve a token .
// Check if there is no ACL datacenter (ACLs disabled) // Handle the anonymous token // Check if we are the ACL datacenter and the leader, use the // authoritative cache // Use our non-authoritative cache