code: func (connection *VSphereConnection) login(ctx context.Context, client *vim25.Client) error {
  	m := session.NewManager(client)
  	connection.credentialsLock.Lock()
  	defer connection.credentialsLock.Unlock()
  
  	signer, err := connection.Signer(ctx, client)
  	if err != nil {
  		return err
  	}
  
  	if signer == nil {
  		klog.V(3).Infof("SessionManager.Login with username %q", connection.Username)
  		return m.Login(ctx, neturl.UserPassword(connection.Username, connection.Password))
  	}
  
  	klog.V(3).Infof("SessionManager.LoginByToken with certificate %q", connection.Username)
  
  	header := soap.Header{Security: signer}
  
  	return m.LoginByToken(client.WithHeader(ctx, header))
  }
docs: // login calls SessionManager.LoginByToken if certificate and private key are configured,
  // otherwise calls SessionManager.Login with user and password.