Adding a custom authentication protocol to OpenWrt

I would like to add a ticket based authentication mechanism to my network. Can you give me brief idea where do I start, which language should i write the protocol in and how do i get those in my custom openwrt firmware.

You might be interested in this.

You can do all kinds of things with it, as is, or build on the idea and do your own thing with it.