Boundary conditions on the magnetic field

Is the magnetic field discontinuos or not at a boundary? What if there is a surface current density $\myv K$?

Perpendicular component

Since $\myv \grad \cdot \myv B = 0$, we can use the divergence theorem to write (for any closed surface $\cal{S}$): $$\oint_{\cal S}\myv B\cdot d\myv a = 0.$$

Consider the Gaussian pillbox (of vanishingly small extension above and below the surface; top surface area $A$) that encloses the surface current density:

$$0=\oint_{\cal S} \myv B\cdot d\myv a = AB^\perp_\text{above} - AB^\perp_\text{below}$$ $$\Rightarrow B^\perp_\text{above} = B^\perp_\text{below}.$$ The perpendicular component is continuous across a surface current.

Tangential component

Since $\myv \grad \times \myv B = \mu_0 \myv J$, we worked out that the fundamental theorem for curls tells us that for any closed path ${\cal P}$: $$\oint_{\cal P} \myv B\cdot d\myv l = \mu_o I_\text{enc}$$

For an Amperian loop positioned perpendicular to $\myv K$ as shown below (vanishingly small extension above and below the surface; length $l$ parallel to the surface):

$$\mu_0Kl=\oint_{\cal P} \myv B\cdot d\myv l = lB^\parallel_\text{above} - lB^\parallel_\text{below}$$ $$\Rightarrow B^\parallel_\text{above} - B^\parallel_\text{below}=\mu_0 K.$$ There is a discontinuity of $\mu_0 K$ for this parallel component of $\myv B$.

For an Amperian loop positioned parallel to to $\myv K$ (not shown) the enclosed current is 0, and so the parallel component of the field in that direction is continuous across the current density.

Putting these three results together for the three component of the field:

$$\myv B_\text{above} - \myv B_\text{below}=-\mu_0 \myv K \times \uv n$$

Where $\uv n$ is the surface normal pointing "above" the surface.