<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dhruv Agnihotri on Medium]]></title>
        <description><![CDATA[Stories by Dhruv Agnihotri on Medium]]></description>
        <link>https://medium.com/@mealodestar?source=rss-3d67d89286b5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aIau_IxpKwHD9ANK</url>
            <title>Stories by Dhruv Agnihotri on Medium</title>
            <link>https://medium.com/@mealodestar?source=rss-3d67d89286b5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 07:16:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mealodestar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Decoding User Data with AEM SSO: Fetching User Details from IDP]]></title>
            <link>https://medium.com/@mealodestar/decoding-user-data-with-aem-sso-fetching-user-details-from-idp-079d8f4a7690?source=rss-3d67d89286b5------2</link>
            <guid isPermaLink="false">https://medium.com/p/079d8f4a7690</guid>
            <category><![CDATA[adobe-experience-manager]]></category>
            <category><![CDATA[saml2]]></category>
            <category><![CDATA[aem-sso]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[sso]]></category>
            <dc:creator><![CDATA[Dhruv Agnihotri]]></dc:creator>
            <pubDate>Tue, 15 Jul 2025 15:26:13 GMT</pubDate>
            <atom:updated>2025-07-15T15:26:13.855Z</atom:updated>
            <content:encoded><![CDATA[<p>Setting up <strong>Single Sign-On (SSO)</strong> on your AEM Cloud Service website improves the user experience. But how do you get those user details in the <strong><em>PUBLISHER</em></strong> environment after SSO LOGIN is done and user is redirected back to the website. This article explains how to retrieve user information from a SAML response within AEM SSO.</p><h3>Understanding the SAML Response:</h3><p>After setting <a href="https://experienceleague.adobe.com/en/docs/experience-manager-learn/cloud-service/authentication/saml-2-0"><strong>SAML authenticator handler configuration</strong></a><strong>. </strong>When a login request is triggered to IDP (Identity Provider), it will validate the user and send a response called <strong>SAML RESPONSE</strong>. This response contains various user attributes, like their name, email, and other details configured in your IDP.</p><p>The SAML response from IDP is <strong>Base64-encoded</strong>. This means it’s a long string of characters that needs to be decoded before you can access the actual user data. When using the SAML authenticator handler, the decoding of the SAML response is handled automatically. You don’t need to write any custom code for this in AEM Cloud. The handler takes care of it behind the scenes, making it easier to access the user attributes in your AEM application. Here’s an example of what a Base64-encoded SAML response might look like:</p><pre>PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6cHJvdG9jb2xzIiBJRD0iXzk0ZmM3MjM4LTNmYjktNDNmZi05M2M5LTNmYjkyMjU4NWQzNSIgVmVyc2lvbj0iMi4wIiBJc3N1ZUluc3RhbnQ9IjIwMjMtMTAtMjdUMTg6MjM6MDUuNDc3WiIgRGVzdGluYXRpb249Imh0dHBzOi8vZXhhbXBsZS5jb20vYXV0aC9hY3MiPjxzYW1scDpJc3N1ZXIgeG1sbnM6c2FtbD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbnMiPmh0dHBzOi8vYXV0aC5leGFtcGxlLmNvbTwvc2FtbHA6SXNzdWVyPjxzYW1scDpTdGF0dXM+PHNhbWxwOlN0YXR1c0NvZGUgVmFsdWU9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpzdGF0dXM6U3VjY2VzcyIvPjwvc2FtbHA6U3RhdHVzPjxzYW1scDpBc3NlcnRpb24geG1sbnM6c2FtbD0id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W1sOklzc3Vlcj48c2FtbDpBdHRyaWJ1dGUgTmFtZT0iZmlyc3ROYW1lIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoxLjE6YXR0cmlidXRlLW5hbWVGb3JtYXQ6dXJpIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZT5Kb2huPC9zYW1sOkF0dHJpYnV0ZVZhbHVlPjwvc2FtbDpBdHRyaWJ1dGU+PHNhbWw6QXR0cmlidXRlIE5hbWU9Imxhc3ROYW1lIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoxLjE6YXR0cmlidXRlLW5hbWVGb3JtYXQ6dXJpIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZTpEb2U8L3NhbWw6QXR0cmlidXRlVmFsdWU+PHNhbWw6QXR0cmlidXRlIE5hbWU9ImVtYWlsIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoxLjE6YXR0cmlidXRlLW5hbWVGb3JtYXQ6dXJpIj48c2FtbDpBdHRyaWJ1dGVWYWx1ZTpKb2huLkRvZUBleGFtcGxlLmNvbTwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbXlwOkF0dHJpYnV0ZVN0YXRlbWVudD48L3NhbWw6QXNzZXJ0aW9uPjwvc2FtbHA6UmVzcG9uc2U+Cg==</pre><h3>Verifying the User Attributes in SAML Response</h3><p>After successful authentication, IDP redirects the user back to your website. To verify the attribute are available in the response, there are 2 ways:</p><ol><li><strong>SAML Tracer extension in your browser</strong>: You can install an extension called <strong>SAML tracer </strong>in your browser and hit the link to process the Login with IDP. This helps you verify that the SAML response you’ve received contains those attributes.</li><li><strong>Cloud Manager repository</strong>: Add the attributes you want in your SAML Authenticator Handler under Synchronize Attributes. Deploy the config to your cloud environment. Go to your repository in the <strong>Cloud Manager </strong>which will require that your have admin access for the specific environment. There, under the /home/users/X/profile node (where X is the username). You will see the attributes which were mentioned in the SAML authenticator handler are actually added as properties there.</li></ol><h3>Fetching the USER DETAILS:</h3><p>Earlier, we used to implement the AuthenticationInfoPostProcessor class in our custom post-processor class to manipulate or fetch the details received from the IDP. However, this is not recommended now, when you use AuthenticationInfoPostProcessor, it can only fetch the values once when the IDP is triggered.</p><pre>@Component(immediate = true, metatype = false)<br>@Service<br>public class SAMLPostProcessor implements AuthenticationInfoPostProcessor {<br> public void postProcess(AuthenticationInfo info, HttpServletRequest request, HttpServletResponse response)  throws LoginException {<br>    .....Your Code Here......<br> }<br>}</pre><p><strong>ALTERNATIVE </strong>: The alternate way is to use the Resource Resolver API in AEM. Through the Resource Resolver API, we can fetch the session data stored in our repository after the login is completed from the IDP. We will be able to fetch all of the details which are available in the /home/users/X/profile and use it at whatever stage of code we need.</p><p>Here’s a code snippet demonstrating how to fetch user details using the Resource Resolver API:</p><pre>@Inject<br>private ResourceResolver resourceResolver;<br><br>@PostConstruct<br>protected void init() {<br>  UserManager userManager = resourceResolver.adaptTo(UserManager.class);<br>  String userId = resourceResolver.getUserID();<br>  Authorizable authorizable = userManager.getAuthorizable(userId);<br>  String givenName = authorizable.getProperty(&quot;profile/givenName&quot;)[0].getString();<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=079d8f4a7690" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>