Let $G$ be a (maybe Lie) group, and $M$ a space (perhaps a manifold). Then a principal $G$-bundle over $M$ is a bundle $P \to M$ on which $G$ acts (by fiber-preserving maps), so that each fiber is a $G$-torsor (a $G$-action isomorphic, although not canonically so, to the action of $G$ on itself by multiplication). A map of $G$-bundles is a bundle map that plays well with the actions.

Then I more-or-less know what the *classifying space* of $G$ is: it's some bundle $EG \to BG$ that's universal in the homotopy category of (principal) $G$-bundles. I.e. any $G$-bundle $P \to M$ has a (unique up to homotopy) map $P\to EG$ and $M \to BG$, and conversely any map $M\to BG$ (up to homotopy) determines a (unique up to isomorphism) bundle $P \to M$ and by pulling back the obvious square.

At least this is how I think it works. Wikipedia's description of $BG$ is here.

So, let $G$ be a Lie group and $M$ a smooth manifold. On a $G$-bundle $P \to M$ I can think about *connections*. As always, a connection should determine for each smooth path in $M$ a $G$-torsor isomorphism between the fibers over the ends of the path. So in particular, a bundle-with-connection is a (smooth) functor from the path space of $M$ to the category of $G$-torsors. But not all of these are connections: the value of holonomy along a path is an invariant up to "thin homotopy", which is essentailly homotopy that does not push away from the image of the curve. So one could say that a bundle-with-connection is a smooth functor from the thin-homotopy-path-space.

More hands-on, a connection on $P \to G$ is a ${\rm Lie}(G)$-valued one-form on $P$ that is (1) invariant under the $G$ action, and (2) restricts on each fiber to the canonical ${\rm Lie}(G)$-valued one-form on $G$ that takes a tangent vector to its left-invariant field (thought of as an element of ${\rm Lie}(G)$).

Anyway, my question is: is there a "space" (of some sort) that classifies $G$-bundles over $M$ with connections? By which I mean, the data of such a bundle should be the same (up to ...) as a map $M \to $ this space. The category of $G$-torsors is almost right, but then the map comes not from $M$ but from its thin-homotopy path space.

Please re-tag as desired.