Get User after SAML login | Community
Skip to main content
Level 2
October 16, 2015
Solved

Get User after SAML login

  • October 16, 2015
  • 4 replies
  • 2344 views

I have SAML 2.0 Authentication Handler working (ootb) and directing to my AEM html page after login.

This page is secured via the Authentication Requirements property in Apache Sling Authentication Service.

It creates a rep:User node (Autocreate CRX Users is enabled) and Properties according to the Synchronized Attributes.

I now want to get those Properties from my AEM html page.

Can someone explain how this is achieved?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by JustinEd3

The Profile interface has been deprecated since CQ 5.5 The preferred way to do this now is:

UserProperties userProps = slingRequest.adaptTo(UserProperties.class); String email = userProps.getProperty("email"); // or whatever

See http://dev.day.com/docs/en/cq/current/javadoc/com/adobe/granite/security/user/UserProperties.html

4 replies

Level 6
October 16, 2015

Are you trying to fetch user info in your jsp? You can always iterate over the fetch user profile node  -

Profile currentProfile = slingRequest.adaptTo(Profile.class);

String profilePath = currentProfile.getPath() ;

 if(session.itemExists(profilePath )) {
                     Node n = session.getNode(profilePath );
                      String id = n.getProperty("<your node prop>").getString();

                // do your stuff

}

JustinEd3Adobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

The Profile interface has been deprecated since CQ 5.5 The preferred way to do this now is:

UserProperties userProps = slingRequest.adaptTo(UserProperties.class); String email = userProps.getProperty("email"); // or whatever

See http://dev.day.com/docs/en/cq/current/javadoc/com/adobe/granite/security/user/UserProperties.html

Level 6
October 16, 2015

Appreciate for this info Justin!

I've seen Profile interface is being used in some OOTB component in 5.6.1 but in AEM6 uses UserProperties 

MorisTMAuthor
Level 2
October 16, 2015

Thanks guys!.

The following article helps me as well 
http://helpx.adobe.com/aem-forms/6/prepopulate-adaptive-form-fields.html