We review the exact treatment of the pairing correlation functions in the canonical ensemble. The key for the calculations has been provided by relating the discrete BCS model to known integrable theories corresponding to the so called Gaudin magnets with suitable boundary terms. In the present case the correlation functions can be accessed beyond the formal level, allowing the description of the cross-over from few electrons to the thermodynamic limit. In particular, we summarize the results on the finite size scaling behavior of the canonical pairing clarifying some puzzles emerged in the past. Some recent developments and applications are outlined.