Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 26 for AuthenticateToken (0.36 sec)

  1. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/tokentest/tokentest.go

    	Tokens map[string]*user.DefaultInfo
    }
    
    func New() *TokenAuthenticator {
    	return &TokenAuthenticator{
    		Tokens: make(map[string]*user.DefaultInfo),
    	}
    }
    
    func (a *TokenAuthenticator) AuthenticateToken(ctx context.Context, value string) (*authenticator.Response, bool, error) {
    	user, ok := a.Tokens[value]
    	if !ok {
    		return nil, false, nil
    	}
    	return &authenticator.Response{User: user}, true, nil
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 22 17:16:59 UTC 2018
    - 1.1K bytes
    - Viewed (0)
  2. plugin/pkg/auth/authenticator/token/bootstrap/bootstrap.go

    func tokenErrorf(s *corev1.Secret, format string, i ...interface{}) {
    	format = fmt.Sprintf("Bootstrap secret %s/%s matching bearer token ", s.Namespace, s.Name) + format
    	klog.V(3).Infof(format, i...)
    }
    
    // AuthenticateToken tries to match the provided token to a bootstrap token secret
    // in a given namespace. If found, it authenticates the token in the
    // "system:bootstrappers" group and with the "system:bootstrap:(token-id)" username.
    //
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Mar 30 20:38:15 UTC 2023
    - 5.1K bytes
    - Viewed (0)
  3. staging/src/k8s.io/apiserver/pkg/authentication/group/token_group_adder_test.go

    			authenticator.TokenFunc(func(ctx context.Context, token string) (*authenticator.Response, bool, error) {
    				return response, true, nil
    			}),
    			[]string{"added"},
    		),
    	)
    
    	r, _, _ := adder.AuthenticateToken(context.Background(), "")
    	if !reflect.DeepEqual(r.User.GetGroups(), []string{"original", "added"}) {
    		t.Errorf("Expected original,added groups, got %#v", r.User.GetGroups())
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed May 11 20:04:50 UTC 2022
    - 1.6K bytes
    - Viewed (0)
  4. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook_v1beta1_test.go

    				return
    			}
    
    			service.Deny()
    			_, authenticated, err = wh.AuthenticateToken(context.Background(), "t0k3n")
    			if err != nil {
    				t.Errorf("%s: unexpectedly failed AuthenticateToken", tt.test)
    			}
    			if authenticated {
    				t.Errorf("%s: incorrectly authenticated token", tt.test)
    			}
    		}()
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Mar 18 00:47:42 UTC 2022
    - 19.2K bytes
    - Viewed (0)
  5. staging/src/k8s.io/apiserver/pkg/authentication/request/bearertoken/bearertoken.go

    		// The space before the token case
    		if len(parts) == 3 {
    			warning.AddWarning(req.Context(), "", invalidTokenWithSpaceWarning)
    		}
    		return nil, false, nil
    	}
    
    	resp, ok, err := a.auth.AuthenticateToken(req.Context(), token)
    	// if we authenticated successfully, go ahead and remove the bearer token so that no one
    	// is ever tempted to use it inside of the API server
    	if ok {
    		req.Header.Del("Authorization")
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 25 13:22:28 UTC 2022
    - 2K bytes
    - Viewed (0)
  6. staging/src/k8s.io/apiserver/pkg/authentication/token/tokenfile/tokenfile.go

    		tokens[record[0]] = obj
    
    		if len(record) >= 4 {
    			obj.Groups = strings.Split(record[3], ",")
    		}
    	}
    
    	return &TokenAuthenticator{
    		tokens: tokens,
    	}, nil
    }
    
    func (a *TokenAuthenticator) AuthenticateToken(ctx context.Context, value string) (*authenticator.Response, bool, error) {
    	user, ok := a.tokens[value]
    	if !ok {
    		return nil, false, nil
    	}
    	return &authenticator.Response{User: user}, true, nil
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat May 16 11:54:27 UTC 2020
    - 2.4K bytes
    - Viewed (0)
  7. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/metrics_test.go

    			if err != nil {
    				t.Error("failed to create client")
    				return
    			}
    
    			_, _, err = wh.AuthenticateToken(context.Background(), "t0k3n")
    			if scenario.wantErr {
    				if err == nil {
    					t.Errorf("expected error making authorization request: %v", err)
    				}
    			}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Tue Jun 29 07:49:14 UTC 2021
    - 3.7K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiserver/plugin/pkg/authenticator/token/webhook/webhook.go

    	return &WebhookTokenAuthenticator{
    		tokenReview,
    		retryBackoff,
    		implicitAuds,
    		requestTimeout,
    		metrics,
    	}, nil
    }
    
    // AuthenticateToken implements the authenticator.Token interface.
    func (w *WebhookTokenAuthenticator) AuthenticateToken(ctx context.Context, token string) (*authenticator.Response, bool, error) {
    	// We take implicit audiences of the API server at WebhookTokenAuthenticator
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Mar 18 00:47:42 UTC 2022
    - 11.5K bytes
    - Viewed (0)
  9. staging/src/k8s.io/apiserver/pkg/authentication/request/websocket/protocol.go

    	if len(token) > 0 && len(filteredProtocols) == 0 {
    		return nil, false, errors.New("missing additional subprotocol")
    	}
    
    	if len(token) == 0 {
    		return nil, false, nil
    	}
    
    	resp, ok, err := a.auth.AuthenticateToken(req.Context(), token)
    
    	// on success, remove the protocol with the token
    	if ok {
    		// https://tools.ietf.org/html/rfc6455#section-11.3.4 indicates the Sec-WebSocket-Protocol header may appear multiple times
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Jun 07 18:21:43 UTC 2023
    - 3.4K bytes
    - Viewed (0)
  10. staging/src/k8s.io/apiserver/pkg/authentication/token/tokenfile/tokenfile_test.go

    			Ok:    true,
    		},
    		{
    			Token: "token8",
    		},
    	}
    	for i, testCase := range testCases {
    		resp, ok, err := auth.AuthenticateToken(context.Background(), testCase.Token)
    		if testCase.User == nil {
    			if resp != nil {
    				t.Errorf("%d: unexpected non-nil user %#v", i, resp.User)
    			}
    		} else if !reflect.DeepEqual(testCase.User, resp.User) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 22 17:16:59 UTC 2018
    - 3.6K bytes
    - Viewed (0)
Back to top