This is also answered [here](http://nat.sakimura.org/2013/07/28/write-openid-connect-server-in-three-simple-steps/)