How to redirect to custom login page in case of AEM OAuth flow failure
Learn how to redirect to the custom login page in case of AEM OAuth flow failure by redirecting the users to the custom login page.
Description description
Environment
Experience Manager
Issue/Symptoms
How to redirect to the custom login page in an Adobe Experience Manager (AEM) publish environment in case of AEM Open Authorization (OAuth) flow failure?
Resolution resolution
In the case of Security Assertion Markup Language (SAML)/OAuth flow, if there is an error in the AEM authentication flow, the system will redirect to the default Out-of-the-box (OOTB) AEM login page.
Hence, there is a need to redirect the users to the custom SAML/OAuth IDP login page. Follow the steps given below:
- Copy this node path /libs/granite/core/content/login to /apps/granite/core/content/login1 as below.
- Change the resource type of /apps/granite/core/content/login1 to testservice, as shown below:
- Create a
rep:policy
node under login1 with allow child, as shown below: - Create a testservice folder under /apps and add sling:resoureType with testservice and create a JSP file called testservice.jsp, as shown below: (Note: In case of OAuth flow, please make sure to append /j_security_check?configid=
<
respective oauth confiid>
to the secured redirect path in the JSP below) - Open the OSGI config Adobe Granite Login Selector Authentication Handler and change the Default Login Page to /apps/granite/core/content/login1 and customize the
auth.loginselector.mappings
property to point to my overlayed login page for your secured path. See below: - Open the OSGI config Apache Sling Authentication Service and add -/apps/granite/core/content/login1 and -/apps/testservice to the
sling.auth.requirements
list. See below:
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f