How to validate credentials from a form in Adobe EM 6.1 (Login funcionality) | Adobe Higher Education
Skip to main content
Level 2
March 4, 2016
해결됨

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

  • March 4, 2016
  • 5 답변들
  • 1827 조회

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.

이 주제는 답변이 닫혔습니다.
최고의 답변: __96

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

5 답변

Jitendra_S_Toma
Level 10
March 4, 2016

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

Level 2
March 7, 2016

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.

__96
__96답변
Level 4
March 7, 2016

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

smacdonald2008
Level 10
March 7, 2016

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. 

Level 2
March 8, 2016

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

Best regards.