I have a MVC project running episerver and are setting up identityserver authentication. Logging in and out works just fine, but when I try to access a page that require a role I get stuck in a redirect loop:
- Epi says I am unauthorized (due to missing role, i am authenticated) and redirects to IDS
- IDS says I am authenticated (I am, but I am missing a role to access a specific page) and redirects me back to Epi.
So what I would like to do is to hook up in the EPI authorization chain and redirect users that are unauthorized due to roles to a friendly page telling them that they do not have the required permissions to do this, while unauthenticated users get sent to the IDS.
I've been looking at the ContentController<T> and [AuthorizeContent] attribute but I cant find any way to override or extend or hook into either of those.
What I would really like to avoid is making a custom attribute and sticking this on every controller, or making a base controller that everything has to inherrit because it is a pretty large project with a lot of controllers and more being added regularly.