How to create custom Authentication Handler | Community
Skip to main content
Level 3
September 3, 2018
Solved

How to create custom Authentication Handler

  • September 3, 2018
  • 5 replies
  • 9514 views

Hello All,

              I want to create AEM bundle as my custom authentication.

Can some one help me out the right steps with implementation example.

Regards

Qamar

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

5 replies

Level 3
September 3, 2018

Thanks Arun for quick reply. Will check and update.

Regards

Qamar

Level 3
September 7, 2018

Hello Arun,

  Thanks for post. Now I have successfully implemented my custom authentication handler bundle. Now on next  step  I am trying to login with my username and password by using http://[localhost]:[port]/j_mycustom_security_check?j_username=[user]&j_password=[password] so that I can get login session token as below

//Extract data from request Object

public AuthenticationInfo extractCredentials(HttpServletRequest request, HttpServletResponse response) {

       if (REQUEST_METHOD.equals(request.getMethod()) && request.getRequestURI().endsWith(REQUEST_URL_SUFFIX)) {

        log.info("extractCredentials "+request.getParameter(USER_NAME)+request.getParameter(PASSWORD));

       URL objurl = new URL("http://[localhost]:[port]/j_security_check?j_username=[user]&j_password=[password]");

       HttpURLConnection connect = (HttpURLConnection) objurl.openConnection(); 

        connect .setRequestMethod("POST");

        connect .setDoOutput(true);

        connect .setDoInput(true);

        connect .setRequestProperty("Content-Type", "application/json;charset=utf-8");

        connect .connect();

        int iCode = connect .getResponseCode();

     }

}

Can you help me what is going incorrect here? I am getting 403 error.

Regards

Qamar

arunpatidar
Community Advisor
Community Advisor
September 8, 2018

Hi,

It could be a permission issue.Try to hit URL from browser

and check this 403 forbidden error on dispacther url for j_security_check

Arun Patidar
Level 3
September 10, 2018

Hi Arun,

          Ok I will check the permission and firewall and try to post request for j_security_check login. Also will check the redirected post link.

Thanks

Qamar