Expand my Community achievements bar.

SOLVED

How to create custom Authentication Handler

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
5 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Level 3

Thanks Arun for quick reply. Will check and update.

Regards

Qamar

Avatar

Level 3

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

Avatar

Community Advisor

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

Avatar

Level 3

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