on 2020 Feb 25 1:51 AM
Hi ,
I am pretty new to SAP world. I need your help to understand the issue that I am currently facing.
I have added custom action in SAP MII , which will connect with the authentication system and get the token from OAuth. Simple java works as expected but when I added the same classes as custom action I am getting connection reset error.
Log:
Code:
HttpURLConnection conn= (HttpURLConnection)url.openConnection(); conn.setDoOutput( true ); String authStr = sClientId + ":" + sSecret; instance.log(LogLevel.INFO, "OAuth Token client id:"+sClientId); String encodedAuth = DatatypeConverter.printBase64Binary(authStr.getBytes("UTF-8")); conn.setRequestMethod( "POST" ); conn.setRequestProperty( "Authorization", "Basic " + encodedAuth); conn.setRequestProperty( "Content-Length", Integer.toString( postDataLength )); conn.getOutputStream().write(postData); instance.log(LogLevel.INFO, "OAuth Token Completed for :"+sClientId); Reader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); for (int c; (c = in.read()) >= 0;){ sb.append((char)c); }
Any inputs are highly appreciated.
You may want to look into using Netweaver Destinations but you may run into the same TLS version issues.
You can also dig around the Netweaver java api's, sometimes SAP has its own custom functionality in there to deal with stuff that maybe that version of the core JRE doesn't yet etc.
When dealing with custom actions there are a few things to consider.
FYI your "Cannot cast class com.sap.engine.httpdsrclient.protocols.instrumented.https.DSRHttpsURLConnection to class javax.net.ssl.HttpsURLConnection" error is usually caused because there was a change in the java API at some point for HttpsURLConnection so make sure your versions are all sorted.
Regards,
Christian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You want to authenticate against OKTA with a "client id?" and get the OAUTH token back. You never really explained why you are trying to do that. This information might help people help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Chris,
We are consuming multiple API's in the application and can't give permissions to user who logged into the system. So giving permissions to one application who can able to make call's to back end API's. This way we can reduce maintaining user permissions vs application API permissions.
So our application user used to connect with Siteminder, But now, we are moving to OKTA from SiteMinder.
So SAP MII 15.0 won't support TLS 2 OR higher than TLS 1.5 we are moving this proxy service to handle this scenario and using SAP HTTP POST block action we can make this proxy call with in MII and acheive similar requirement.
why don't you try other way round. in OAUTH we exchange token between the applications. this can be done by using servlet in java and that can be easily developed in SAP MII.
Regards,
Ankit Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for your response Ankit. Do you have any samples of your approach? I followed SAP MII Custom action documentation and created HTTP Client using those libraries(https://help.sap.com/saphelp_me151/helpdata/en/4c/8cee70f2bd60c5e10000000a15822d/content.htm?no_cach...).
From the comment on your question, what I am able to understand is that, you need to get the token from the 3rd party system so you don’t have to manage the credentials. (OAUTH functionality).
Why don’t you authenticate first and then execute your logic?
you can develop the same in SAP MII web app using java for authenticating the user and then you can execute your transaction logics.
And regarding the sample code, I don’t have any right now you need to try it on your own.
Regards,
Ankit Gupta
Hi,
Thanks for your suggestion.
Actually, I need to connect one of the application user in the SAP MII, not the login authentication. Here I can't use servlet also while doing some search on SAP MII 15.0 I found it uses java 6 and Java 6 only support TLS 1.0 which okta won't support. Which are eventually roadblock?
-Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.