Hi @McDonald, Bruce , to redirect users to a custom page when they fail to authenticate, you can use the onAuthenticationError
method of the AADAuthenticationFilter
class. This method is called when authentication fails, and you can use it to redirect the user to a custom error page.
For Spring Boot you can make something like this:
- Create a custom error page in your application. This page should provide information to the user about why their authentication failed and what they can do to resolve the issue.
- In your Spring Boot application, create a class that extends
AADAuthenticationFilter
. - Override the
onAuthenticationError
method in your custom filter class. In this method, you can redirect the user to your custom error page. - Register your custom filter class with Spring Boot by adding it to your application's configuration:
If this doesn't work or you need more detail please let me know.
Please let me know if you have any questions and I can help you further.
If this answer helps you please mark "Accept Answer" so other users can reference it.
Thank you,
James