Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for MatchesUsername (0.32 sec)

  1. staging/src/k8s.io/apiserver/pkg/util/flowcontrol/rule.go

    			return false
    		}
    		if subject.ServiceAccount.Name == flowcontrol.NameAll {
    			return serviceAccountMatchesNamespace(subject.ServiceAccount.Namespace, user.GetName())
    		}
    		return serviceaccount.MatchesUsername(subject.ServiceAccount.Namespace, subject.ServiceAccount.Name, user.GetName())
    	default:
    		return false
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 30 12:18:35 UTC 2023
    - 6.3K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount/util_test.go

    		"invalid chars in name": {
    			Namespace:   "foo",
    			Name:        "bar ",
    			ExpectedErr: true,
    		},
    	}
    
    	for k, tc := range testCases {
    		username := MakeUsername(tc.Namespace, tc.Name)
    		if !MatchesUsername(tc.Namespace, tc.Name, username) {
    			t.Errorf("%s: Expected to match username", k)
    		}
    		namespace, name, err := SplitUsername(username)
    		if (err != nil) != tc.ExpectedErr {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 30 21:15:10 UTC 2023
    - 7.7K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount/util.go

    	return ServiceAccountUsernamePrefix + namespace + ServiceAccountUsernameSeparator + name
    }
    
    // MatchesUsername checks whether the provided username matches the namespace and name without
    // allocating. Use this when checking a service account namespace and name against a known string.
    func MatchesUsername(namespace, name string, username string) bool {
    	if !strings.HasPrefix(username, ServiceAccountUsernamePrefix) {
    		return false
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Feb 05 10:24:31 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  4. pkg/registry/rbac/validation/rule.go

    		if len(subject.Namespace) > 0 {
    			saNamespace = subject.Namespace
    		}
    		if len(saNamespace) == 0 {
    			return false
    		}
    		// use a more efficient comparison for RBAC checking
    		return serviceaccount.MatchesUsername(saNamespace, subject.Name, user.GetName())
    	default:
    		return false
    	}
    }
    
    // NewTestRuleResolver returns a rule resolver from lists of role objects.
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Nov 02 16:51:16 UTC 2020
    - 11.6K bytes
    - Viewed (0)
Back to top