For $G$ a Lie group with Lie algebra $\mathfrak{g}$, a $G$-principal bundle $P \to X$ on a smooth manifold $X$ induces a collection of classes in the de Rham cohomology of $X$: the classes of the curvature characteristic forms
of the curvature 2-form $F_A \in \Omega^2(P, \mathfrak{g})$ of any connection on $P$, and for each invariant polynomial $\langle -\rangle$ of arity $n$ on $\mathfrak{g}$.
This is a map from the first nonabelian cohomology of $X$ with coefficients in $G$ to the de Rham cohomology of $X$
where $i$ runs over a set of generators of the invariant polynomials. This is the analogy in nonabelian differential cohomology of the generalized Chern character map in generalized Eilenberg-Steenrod-differential cohomology.
We describe the refined Chern-Weil homomorphism (which associates a class in ordinary differential cohomology to a principal bundle with connection) in terms of the universal connection on the universal principal bundle. We follow (HopkinsSinger, section 3.3).
with Lie algebra $\mathfrak{g}$;
and write $inv(\mathfrak{g})$ for the dg-algebra of invariant polynomials on $\mathfrak{g}$ (which has trivial differential).
Write $B^{(n)}G$ for the smooth level $n$ classifying space
and $B G := {\lim_\to}_n B^{(n)}G$ for the colimit, a smooth model of the classifying space of $G$.
Write $\nabla_{univ}$ for the universal connection on $E G \to B G$.
Let $[c] \in H^k(B G, \mathbb{Z})$ be a characteristic class
and choose a refinement $[\hat \mathbf{c}] \in H_{diff}^k(B G)$ in ordinary differential cohomology represented by a differential function
For $X$ a smooth manifold, $P \to X$ a smoth $G$-principal bundle with smooth classifying map $f : X \to B G$ and connection $\nabla$. Write $CS(\nabla, f^* \nabla_{univ})$ for the Chern-Simons form for the interpolation between $\nabla$ and the pullback of the universal connection along $f$.
Then defined the cocycle in ordinary differential cohomology given by the function complex
The above construction constitutes a map
from equivalence classes of $G$-principal bundles with connection to degree $k$ ordinary differential cohomology.
(…)
A classical textbook reference is
The description of the refined Chern-Weil homomorphism in terms of differential function complexes is in section 3.3. of
For more references see Chern-Weil theory.