Reading an article I faced with the following theorem, please give me a reference to a proof of the fact which is stated without any reference in the article. Is it a well-known fact?

**Theorem.** Let $E \overset{\pi}{\to} M$ be a complex line bundle over a Riemann surface $M$ with boundary $\partial M$. Let $\nabla^1$ and $\nabla^2$ be connections on $E$ with connection 1-forms $A_1$ and $A_2$. Then the following statements are equal:

There exists a unitary bundle isomorphism $F \colon E \to E$ such that $F = Id$ on $E|_{\partial M}$ and $\nabla^1 = F^* \nabla^2 F$.

Let $\gamma_1$, $\ldots$, $\gamma_M$ be non-homotopically equivalent loops in $M$, non-homotopically equivalent to any boundary component and let $\omega_1$, $\ldots$, $\omega_M$ be a dual basis of $H^1(M,\partial M)$, i.e. $\int_{\gamma_i} \omega_j = \delta_{ij}$. Then $$ A_1 - A_2 = 2\pi \sum\limits_{k=1}^M n_k \omega_k + df, \quad f|_{\partial M} = 0, \; n_k \in \mathbb Z. $$