cancel
Showing results for 
Search instead for 
Did you mean: 

How can I get the Username and Password from the oData service login, as input parameter into ( SEGW transaction ) oData service GET method ?

Momen_Allouh
Advisor
Advisor
0 Kudos

How can I get the Username and Password from the oData service login, as input parameter into ( SEGW transaction ) oData service GET method ?

So that inside the oData service GET method i can write function to Output entries from a table for that specific Username.

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello Momen,

Please try this and check.

But i doubt if you can get user and password from here. Please check once.

Data :  lo_facade type ref to /IWBEP/IF_MGW_DP_INT_FACADE.

lo_facade     ?= /iwbep/if_mgw_conv_srv_runtime~get_dp_facade( ).

lt_client_headers = lo_facade->get_request_header( ).


Regards,

Ashwin

Momen_Allouh
Advisor
Advisor
0 Kudos

The Username and Password appears on the Request URL and not on the Request Header as you see this screen shot from Google chrome browser:

Also I got another idea which is using custom login screen to collect the inputs & after user authorization, if user authorized then I do another request to send the input values using custom parameters like:

http://service-url-example/?customUser='P1940369202' & customPass='7*****0'

The question now is how can I get these custom input parameters from SEGW ? and from which oData method GET or POST ?

Then I can look for that customUser='P1940369202' and output his own entries from any table for example ( output user  P1940369202 emails from an emails table)

kammaje_cis
Active Contributor
0 Kudos

Momen,

Password will not be available and it is not a good idea to read user's password from security aspect.

Current username is always available at variable SY-UNAME.

What do you want to do with the password anyway?

Thanks

Krishna

Momen_Allouh
Advisor
Advisor
0 Kudos

Right in that case the user can't play with his name from client side.

The reason I put password because I was thinking that if any user has access to the service then he can play with the "usename input parameter" so he can see other users data.

But now the problem solved because there will be no input parameters at all.

so once he login and authorized and once he call the /Emails entity without any custom parameters then inside the GET method I will have his SY-UNAME to get his emails.


Thanks.

Answers (1)

Answers (1)

kammaje_cis
Active Contributor
0 Kudos

I am not sure if I understood your question correct.

But while creating an OData model, you can pass userid and password.

var sUrl = "http://service.url";

var oModel = new sap.ui.model.odata.ODataModel(sUrl, true, username, password);

Momen_Allouh
Advisor
Advisor
0 Kudos

No you didn't you talking about UI5 in Clint side.

I am asking about the SEGW transaction inside NW Gateway server where you create the ABAP code for GET method or POST , Update, delete.