Connections on principal bundles via stacks?

The only thing which has to be replaced in the representation of a principal bundle as a suitable class of a maps $M\to [*/G]$ in order to introduce a flat connection is to replace $M$ by its fundamental 1-groupoid $\Pi_1(M)$, or, if the connection is not flat, by the thin homotopy version $P_1(M)$ of it, cf. nlab:path groupoid. The same way it works for higher categorical generalizations, see Schreiber:differential nonabelian cohomology and for details also Sec. 7.4 (from page 27 on in version 1) in arxiv/1004.2472.


In case you have not seen it, the answer given by Chris Schommer-Pries to the following question might be of interest to you:

What is the classifying space of "G-bundles with connections"

If I understand correctly, the only difference with your question is that you want to fix the base manifold $M$ of your principal $G$-bundles, in which case the stack of principal $G$-bundles with connection on $M$ probably is $Bun_{M,G}^{\nabla} = \left[\Omega^1(M\times -;\mathfrak{g})/G\right]$ ?

If in addition you want to fix a particular bundle $P$ on $M$ and look at all possible $G$-connections on it, then the end of your post is reminiscent of Kobayashi's bundle of connections in his PhD thesis work:

S. Kobayashi (1957). "Theory of Connections". Annali di Matematica Pura ed Applicata 43: 119–194. doi:10.1007/bf02411907

which is also referred to on Wikipedia:

https://en.wikipedia.org/wiki/Connection_(principal_bundle)#Bundle_of_principal_connections

The $G$-connections on $P$ are the sections of the fibre bundle $(TP)/G \to TM$, where the map to $TM$ is induced by the differential of $P\to M$ and the action of $G$ on $TP$ is induced by its action on $P$.