Hi,
We also implemented the same with cug and external IDP login page.
1. we have a filter to redirect the user to the login page if the page is protected and the user is not logged in
2. for cached pages, we use permission sensitive caching to check if page access.
3. used token service to create a user in aem and added group received from external identity server, created aem session and created few cookies to store user/session related data.
Arun Patidar