Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for WithAudiences (0.18 sec)

  1. staging/src/k8s.io/apiserver/pkg/authentication/authenticator/audiences.go

    // The key type is unexported to prevent collisions
    type key int
    
    const (
    	// audiencesKey is the context key for request audiences.
    	audiencesKey key = iota
    )
    
    // WithAudiences returns a context that stores a request's expected audiences.
    func WithAudiences(ctx context.Context, auds Audiences) context.Context {
    	return context.WithValue(ctx, audiencesKey, auds)
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Oct 31 21:50:11 UTC 2018
    - 1.7K bytes
    - Viewed (0)
  2. pkg/registry/authentication/tokenreview/storage.go

    	auds := tokenReview.Spec.Audiences
    	if len(auds) == 0 {
    		auds = r.apiAudiences
    	}
    	if len(auds) > 0 {
    		fakeReq = fakeReq.WithContext(authenticator.WithAudiences(fakeReq.Context(), auds))
    	}
    
    	resp, ok, err := r.tokenAuthenticator.AuthenticateRequest(fakeReq)
    	tokenReview.Status.Authenticated = ok
    	if err != nil {
    		tokenReview.Status.Error = err.Error()
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Nov 18 09:21:13 UTC 2022
    - 3.7K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator_test.go

    	resultUsers["audBusertoken1"] = &user.DefaultInfo{Name: "user1-different"}
    
    	if u, ok, _ := a.AuthenticateToken(authenticator.WithAudiences(context.Background(), []string{"audA"}), "usertoken1"); !ok || u.User.GetName() != "user1" {
    		t.Errorf("Expected user1")
    	}
    	if u, ok, _ := a.AuthenticateToken(authenticator.WithAudiences(context.Background(), []string{"audB"}), "usertoken1"); !ok || u.User.GetName() != "user1-different" {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jul 03 16:16:51 UTC 2023
    - 20.3K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/pkg/authentication/authenticator/audagnostic_test.go

    				for _, treq := range c.treqs {
    					t.Run(fmt.Sprintf("auds=%q,implicit=%q", taudcfg.auds, taudcfg.implicitAuds), func(t *testing.T) {
    						ctx := context.Background()
    						ctx = WithAudiences(ctx, taudcfg.auds)
    						resp, ok, err := authenticate(ctx, taudcfg.implicitAuds, func() (*Response, bool, error) {
    							if treq.resp != nil {
    								resp := *treq.resp
    								return &resp, treq.authenticated, treq.err
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 12 15:46:16 UTC 2023
    - 4.9K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/endpoints/filters/authentication.go

    	}
    	return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
    		authenticationStart := time.Now()
    
    		if len(apiAuds) > 0 {
    			req = req.WithContext(authenticator.WithAudiences(req.Context(), apiAuds))
    		}
    		resp, ok, err := auth.AuthenticateRequest(req)
    		authenticationFinish := time.Now()
    		defer func() {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Oct 12 20:54:07 UTC 2023
    - 6.4K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/authentication/token/cache/cached_token_authenticator.go

    		// however propagate the audience.
    		ctx, cancel := context.WithTimeout(context.Background(), sharedLookupTimeout)
    		defer cancel()
    
    		if audsOk {
    			ctx = authenticator.WithAudiences(ctx, auds)
    		}
    		recorder := &recorder{}
    		ctx = warning.WithWarningRecorder(ctx, recorder)
    
    		ctx = audit.WithAuditContext(ctx)
    		ac := audit.AuditContextFrom(ctx)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Jul 03 16:16:51 UTC 2023
    - 9.8K bytes
    - Viewed (0)
  7. pkg/serviceaccount/jwt_test.go

    		}
    		authn := serviceaccount.JWTTokenAuthenticator([]string{serviceaccount.LegacyIssuer, "bar"}, tc.Keys, auds, validator)
    
    		// An invalid, non-JWT token should always fail
    		ctx := authenticator.WithAudiences(context.Background(), auds)
    		if _, ok, err := authn.AuthenticateToken(ctx, "invalid token"); err != nil || ok {
    			t.Errorf("%s: Expected err=nil, ok=false for non-JWT token", k)
    			continue
    		}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Feb 27 22:16:08 UTC 2024
    - 17K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook_v1beta1_test.go

    			if err != nil {
    				t.Fatal(err)
    			}
    
    			ctx := context.Background()
    			if tt.reqAuds != nil {
    				ctx = authenticator.WithAudiences(ctx, tt.reqAuds)
    			}
    
    			serv.response = tt.serverResponse
    			resp, authenticated, err := wh.AuthenticateToken(ctx, token)
    			if err != nil {
    				t.Fatalf("authentication failed: %v", err)
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Mar 18 00:47:42 UTC 2022
    - 19.2K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook_v1_test.go

    			if err != nil {
    				t.Fatal(err)
    			}
    
    			ctx := context.Background()
    			if tt.reqAuds != nil {
    				ctx = authenticator.WithAudiences(ctx, tt.reqAuds)
    			}
    
    			serv.response = tt.serverResponse
    			resp, authenticated, err := wh.AuthenticateToken(ctx, token)
    			if err != nil {
    				t.Fatalf("authentication failed: %v", err)
    			}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Mar 18 00:47:42 UTC 2022
    - 19.1K bytes
    - Viewed (0)
Back to top