Handle the Authentication process through WCF REST Service

Slacker

Active Member
Licensed User
Longtime User
Hello Folks, i think lot of users have faced this aspect in their developing.
I'm using a WCF REST Service and I need to handle the login and authentication process; using ASP.NET Form authentication was pretty easy being there are underlying integrated modules do the work behind the scenes using authentication cookie.

Moving towards this technology and using HttpUtils2, i'm trying to image how i might recognize logged user having on the other side a WCF REST Service. I suppose i have to use cookie as expected to make the job but i would to know if you could suggest me - using the above-mentioned technology - to make the process smoother and easy. It should be appreciated a little of code how to handle auth cookie and authentication process (and how to handle the model "slide expiration" about logged session as ASP.NET do) using httputils2 framework and WCF REST Service.

Thank you in advance!
 

Slacker

Active Member
Licensed User
Longtime User
Erel, in the previous model i used a cookie in asp.net to identify the user logged. I managed the logging process by code checking in DB and setting a cookie in browser to identify its session in subsequential http calls. In this case using WCF REST Service, i would to know using for example httputils2 framework what should be the best way to figure out because we have now an APP and not a web browser.

Thank you Erel.
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
Is there no any way to recreate a model to identify the user as authenticated using httputils2 with WCF REST Service ? Should i have implement a custom logic by myself ?
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
I'm using HttpJob object not HttpClient. You suggest to use this for WCF Service but i didn't see in it any methods or properties useful to handle the cookies/headers....
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
HttpUtils2 is based on HttpClient. You can see its code here:
HttpUtils2 - Web services are now even simpler

You can add headers to the request by calling:
Job.GetRequest.SetHeader. Note that you should call it right after you call Job.Download.

You will need to modify HttpUtills2Service in order to read the response headers.
 
Upvote 0

Slacker

Active Member
Licensed User
Longtime User
THanks Erel, i was thinking what you told as modifying httputils2service to read response header....could show me some quick code snippet where could i point to regard to this response header stuff ?

Thanks of all Erel.
 
Upvote 0
Top