Decorating your SaaS offering with multi-tenant Single-Sign-On (SSO) can be a huge benefit, allowing your enterprise users to switch between their Office 365 home and your web app seamlessly.
While you can find a few resources that help you build just that, most of them are in the form of a project template or a complete solution on Github. Like this one (TodoListWebApp). For my projects I prefer to keep them clean, and write as much code by myself; avoiding templates that carry more capabilities than I need, or even carry out operations that I don’t completely understand.
You can find my complete tutorial here https://blog.puneusergroup.org/building-a-multi-tenant-active-directory-web-app/