Search This Blog

Wednesday, May 17

Logon to SAP EP Programatically by using UMFactory's LogonAuthenticator.Logon

@ NIIT Technologies, Marwah Centre, Mumbai


I am trying to write a java program which logs on a user to SAP EP with a user and password provided to the program. Some literature about it is available on the internet but no luck since couple of days. People are talking about using UMFactory's LogonAuthenticator.Logon method to log the user in. I tried it with various authentication schemes like basicauthentication, uidpwdlogon, certlogon etc but failed every time unfortunately. There are no error logs getting generated in the stack traces of server to guide me further towards solution.

Logon by posting j_user and j_password to EP URL.
I am alternatively posting j_user and j_password variables to EP URL to log the user on. It works. See below form for reference.


   
   
   


  For the former method, I am could see that in authentication of EP in nwa, below message about authentication policies is being displayed. I beleive, the warning being displayed in causing the problem







The message is 'There are conflicting policy configurations: [anonymous,default,certlogon,uidpwdlogon,UserAdminScheme,basicauthentication]'


My Source code the for the former approach
         request.setAttribute(ILoginConstants.LOGON_UID_ALIAS,"useridtest");
         request.setAttribute(ILoginConstants.LOGON_PWD_ALIAS,"passwordtest");
         try
         {
            UMFactory.getLogonAuthenticator().logon(request, response, "uidpwdlogon");
         }
         catch(javax.security.auth.login.LoginException e)
         {
             out.println (e.getStackTrace());
         }

Result printed on screen from stack Trace[Ljava.lang.StackTraceElement;@35ab660e

All suggestions to above problem are welcome.