Get User after SAML login

Avatar

Avatar

MorisTM

Avatar

MorisTM

MorisTM

15-10-2015

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

justin_at_adobe

Employee

Avatar

justin_at_adobe

Employee

justin_at_adobe
Employee

15-10-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

Answers (3)

Answers (3)

Avatar

Avatar

MorisTM

Avatar

MorisTM

MorisTM

15-10-2015

Thanks guys!.

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

Avatar

Avatar

Sam205505050

Avatar

Sam205505050

Sam205505050

15-10-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 

Avatar

Avatar

Sam205505050

Avatar

Sam205505050

Sam205505050

15-10-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

}