Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How to validate credentials from a form in Adobe EM 6.1 (Login funcionality)

Avatar

Level 2

Hi all,

I'm new in Adobe EM so I'd really appreciate some help. I have a custom login form (.jsp) where the username/password are requested. I would like to validate this credentials against repository. 

Is there any sample/documentation that I can check to do this? 

Thanks a lot in advance for your help!

Best regards.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi,

The way I used to do validation was like below :

String login = decodedStr.substring(0, p).trim(); String password = decodedStr.substring(p + 1).trim(); Credentials credentials = new SimpleCredentials(login,password.toCharArray()); Session session = repository.login(credentials);

The login and password I have used is from some string. you can modify as per your requirement os simply user username and password coming in form or from wherever you desire and after this all you have to do is check the session.

 

Regards,

Samir

View solution in original post

5 Replies

Avatar

Level 9

Check login component OOTB. It has login.jsp which makes http call for the authentication and also login.

Locations of the files:

/libs/foundation/components/login

/libs/cq/core/content/login

FYI: 

---Jitendra

Avatar

Level 2

Thanks Jitendra!

I have a custom form so I thought I would need custom code to validate the user and I couldn't use OOTB but I'll check the files you mention. 

Best regards.

Avatar

Correct answer by
Level 4

Hi,

The way I used to do validation was like below :

String login = decodedStr.substring(0, p).trim(); String password = decodedStr.substring(p + 1).trim(); Credentials credentials = new SimpleCredentials(login,password.toCharArray()); Session session = repository.login(credentials);

The login and password I have used is from some string. you can modify as per your requirement os simply user username and password coming in form or from wherever you desire and after this all you have to do is check the session.

 

Regards,

Samir

Avatar

Level 10

IN addition to the great answers provided by these AEM Community members, I recommend that you watch this AEM Ask the Community Experts on this subject given by Justin: 

Building Secure Adobe Experience Manager Web Sites

There is a link to the webinar in the Summary Table at start of article. 

Hope this helps. 

Avatar

Level 2

Thanks all for your help! I was able to validate the user with the info you provided.

Best regards.