If you're a Cocoa developer, you'll like this free source code.
The BLAuthentication class encapsulates all the dirty-work you'd otherwise need to do to use Security.framework in Mac OS X to authorize a user to perform tasks as the root user, just like the Installer app, Software Update and the Network System Prefs panel do.
The nice thing is, "it just works". After staring at this code for a few hours, that's incredibly appreciated! :)
Update: That link no longer works, but I found it here.