Was looking for a way to connect to SharePoint online using CSOM through a windows application. Found this wonderful article that explains in details about the same.
It also provides us with a helper class name MsOnlineClaimsHelper that does all the heavy lifting for us.
MsOnlineClaimsHelper claimsHelper = new MsOnlineClaimsHelper(“https://xyz.com/sites/dev”, “email@example.com”,“pwd”);
Hope it helps.