This paper describes a model of electron energization and cyclotron-maser emission applicable to astrophysical magnetized collisionless shocks. It is motivated by the work of Begelman, Ergun and Rees [Astrophys. J. 625, 51 (2005)] who argued that the cyclotron-maser instability occurs in localized magnetized collisionless shocks such as those expected in blazar jets. We report on recent research carried out to investigate electron acceleration at collisionless shocks and maser radiation associated with the accelerated electrons. We describe how electrons accelerated by lower-hybrid waves at collisionless shocks generate cyclotron-maser radiation when the accelerated electrons move into regions of stronger magnetic fields. The electrons are accelerated along the magnetic field and magnetically compressed leading to the formation of an electron velocity distribution having a horseshoe shape due to conservation of the electron magnetic moment. Under certain conditions the horseshoe electron velocity distribution function is unstable to the cyclotron-maser instability [Bingham and Cairns, Phys. Plasmas 7, 3089 (2000); Melrose, Rev. Mod. Plasma Phys. 1, 5 (2017)].