Hi,
Generally, application urls are protected and if the user is not authenticated, it generates a redirection to the SSO server for authentication and a redirection back to the application after a successful authentication.
For a Single Page Application (based on AngularJs), things get more complicated as AJAX calls are made and for a protected url, if a redirection to the SSO server is started, it won't work. In pac4j, you will receive a 401 error page instead of a redirection if an AJAX call is detected. So you can configure your AngularJS app to handle this use case and call back your main page and triggers a browser login process.
This is how pac4j helps: by delivering 401 error page instead of redirection (302) for AJAX calls.
It's a simple approach you can start with. Though, you may want to go further and handle the login process mainly in Javascript and in that case, the OAuth implicit grant type would be necessary. There is also the CSRF issue to consider.
Thanks.
Best regards,
Jérôme