The canonical quantization of macroscopic electromagnetism was recently
presented in New J. Phys. 12 (2010) 123008. This theory is here used to derive
the Casimir effect, by considering the special case of thermal and zero-point
fields. The stress-energy-momentum tensor of the canonical theory follows from
Noether's theorem, and its electromagnetic part in thermal equilibrium gives
the Casimir energy density and stress tensor. The results hold for arbitrary
inhomogeneous magnetodielectrics and are obtained from a rigorous quantization
of electromagnetism in dispersive, dissipative media. Continuing doubts about
the status of the standard Lifshitz theory as a proper quantum treatment of
Casimir forces do not apply to the derivation given here. Moreover, the correct
expressions for the Casimir energy density and stress tensor inside media
follow automatically from the simple restriction to thermal equilibrium,
without the need for complicated thermodynamical or mechanical arguments.Comment: Minor corrections. 21 pages. To appear in New J. Phy