Connections on principal bundles via stacks? Let G be a Lie group and M a smooth manifold. Suppose that P is a principal G-bundle over M. Then by Yoneda, this corresponds to a smooth map $p:M \to [G]$, where $[G]$ is the differentiable stack associated to G. If P is equipped with a connection, how does this fit in this picture?
I was thinking of using the fact that we can obtain $P$ as the weak pullback of the classifying map p along the universal principal G-bundle $* \to [G]$, and then using that the tangent functor preserves finite weak limits. Then, if we are given a connection in terms of a G-invariant subbundle of $TP$, we could express its inclusion map $H \to TP$ as a map $H \to TM$ together with a certain 2-cell between the composite of the canonical map $H \to [TG]$ (the universal TG-bundle composed with the unique map to the terminal object) and T(p) composed with $H \to TM$. But then of course, we need to put conditions on our map $H \to TM$ to make sure that the induced map $H \to TP$ is an inclusion of vector bundles that moreover defines a G-invariant Ehresmann connection. Maybe this is not the way to go...
Does anyone know of a nice way of encoding a connection in this stacky language?
 A: 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.
A: 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$.
A: I am not sure if this has to be an answer or a comment. I will change it to comment if needed.
Please see section $6$ of Parallel Transport on Principal Bundles over Stacks
. 
Given a Lie group $G$, they associate a stack $B^\nabla G$  over the category of manifolds $\text{Man}$. Then, a principal bundle with connection over a stack $\mathcal{X}$ is a $1$-morphism of stacks $\mathcal{X}\rightarrow B^\nabla G$. In particular, a principal $G$-bundle over a manifold $M$ is a morphism of stacks $M\rightarrow B^\nabla G$.
