cancel
Showing results for 
Search instead for 
Did you mean: 

Get SSO base64 string

Former Member
0 Kudos

Dear developers,

I try to create a JCO.Client. So that I can communicate from a Java project/dc to ABAP.

The JCO.CLient api states this (see code below)

=====================================================

<i>public static JCO.Client createClient(java.lang.String client,

java.lang.String user,

java.lang.String passwd,

java.lang.String lang,

java.lang.String ashost,

java.lang.String sysnr,

java.lang.String gwhost,

java.lang.String gwserv)Creates an instance of a client connection to a remote SAP system (no load balancing) Note: Depending on the SAP system release, logins using Single-Sign-On (SSO) or X509 certificates are being supported.

For SSO specify the user to be $MYSAPSSO2$ and pass the base64 encoded ticket as as the passwd parameter.

For X509 specify the user to be $X509CERT$ and pass the base64 encoded certificate as the passwd parameter.</i>=====================================================

So we can use Single-Sign-On (SSO). But I have no idea how we can get the base64 encoded ticket.

My question is: Who have more information about: "how to pass the base64 encoded ticket as the passwd parameter".

And more important. Has someone any code examples.

Thanx in advance.

Kind regards, Marinus

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Try this

// TODO: Receive The Cookie and SSO String values. From Portal

HttpServletRequest request = ((IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();

Cookie[] cookies = request.getCookies();

String cookieName = "MYSAPSSO2";//SAPCookie;

for ( int i=0; i<cookies.length; i++) {

Cookie cookie = cookies<i>;

if (cookieName.equals(cookie.getName())){

}

}

IUser user1 = WDClientUser.getCurrentUser().getSAPUser();

String sso = (String)user1.getTransientAttribute(IPrincipal.DEFAULT_NAMESPACE, "MYSAPSSO2_STRING");

Pass the String sso as Password

Kind Regards

Mukesh

Former Member
0 Kudos

Hi Mukesh,

I am getting the same eror. For trying out the code that you have given, I need the packages that contain the IWebContextAdapter and IPrincipal. From where can i get those packages?

This is the error i am getting...

<i>Error during initialization of SSO2TICKET:

MySapInitialize failed: rc= 14

static part ends.

java.lang.Exception: MySapEvalLogonTicketEx failed: standard error= 9, ssf error= 0

at com.mysap.sso.SSO2Ticket.evalLogonTicket(Native Method)</i>

Former Member
0 Kudos

Hi,

for IWebContextAdapter in your editor right click mouse and Sorce-Organizeimports then it will come.

Iprinciple you need to add com.sap.security.api jar file.

This might helps.

Thanks

Lohi.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Mukesh,

Thanks a lot for your answer. It worked straight away.

I rewarded you points.

Kind regards,

Marinus