We have a requirement of creating multiple CUG groups for different content hierarchies.
When configured, once a non-logged in user tries to access a restricted page from a particular hierarchy, we see the login page.
Now the user logs in with certain access as per the CUG group membership.
If this user now tries to access content for another CUG group, instead of being sent to login page (where we have messages like 'seems you do not have access....'), we see the 404 page.
Is there a way to resolve this?
Any help will be appreciated.
When a user is not logged in, AEM wants the user to login first, and then it will verify whether user is authorized to view that page or not.
When the user is already logged in and tries to access a restricted page, AEM redirects the user to the default Error Handler Page, as the user is not authorized to view that page.
It seems to be working as expected. It won't make any sense to redirect an already logged-in user to login page when he/she tries to access a restricted page.
What you can do is create a custom error handler page, and you can add a redirect in it to take the unauthorized user to some other page, if you would like to.
To create custom error handler, the following document may be helpful: