We describe a principle for designing double-barrier magnetic tunneling str
uctures that could produce a spin current with controllable spin direction
or have an optimal spin valve effect. The principle is based on the finding
that, by tuning the energy positions of the spin-dependent resonant tunnel
ing of a double-barrier junction, a fully spin-polarized current and optima
l magnetoresistance could be achieved. This is illustrated by numerical cal
culations within a 3-dimensional effective single-electron model of the spi
n-dependent currents in several tunneling structures.