Shadow Only Material

Does anyone know a way to create a material that is only opaque in the area of the received shadow,
and transparent everywhere else.

Similar to the option ‘Shadow Only’ in a Blender material.

Any help is appreciated.