Exactly that.
here's the circuit I use for this stuff. It's not a great current source but it works for driving LEDs over a reasonable range of voltages.
As it's a current source, you can just stack any number of LEDs in series as long as the combined drop is less than VIN - 1v (ish). the 1.5K resistor should be changed for other voltage ranges to maintain about 10mA through the diodes at the lowest expected voltage. BD139 transistor or even smaller ones do the job most of the time
If you want to drive it from an AC source (read isolation transformer), add a rectifier diode and reasonable electrolytic capacitor. You can omit the capacitor if you like 50/60Hz flicker.
You can omit the 1.5K resistor, 2x 1n4148 diodes if you use a MOSFET but picking the resistor value is difficult because it depends on each individual device.