c# - WCF connection with HTTPS security using SSON cookie -


i have little experience cookies need here.

i have scenario have establish wcf connection remote endpoint using https security. situation complicated thing endpoint address in client config pointing web proxy redirects request actual endpoint if sson auth has been detected or redirects auth page.

example: service address client config 'https://a.com/my.svc'. if auth ok connect address, if not, redirected 'https://a.com/auth' , after successful auth proceed again 'https://a.com/my.svc'

if open address in web browser i'm redirected auth page , after successful auth (login/pwd) redirected address. after authenication sson cookie generated , consequent address queries lead me straight address no additional auth.

as of i've done following:

  1. do auth using wpf webbrowser control. i've got cookie after that.
  2. made client endpoint connection. yeah session used default in prod environment, i'm not sure if can remove it.

    <custombinding> <binding name="wshttpsbinding_idb2connector">   <reliablesession inactivitytimeout="23:59:59" ordered="true"/>   <httpstransport requireclientcertificate="false" /> </binding> 

  3. direct connection works fine. mean don't connect proxy address use final endpoint address instead , don't use cookies.

now problem how can made wcf connection use sson coookie bypass auth page on clientbase.open call?

once have sso cookie auth form can use operationcontextscope send http headers.

yourserviceclient client = new yourserviceclient(); using(new operationcontextscope(client.innerchannel))  {     // add http header outgoing request     httprequestmessageproperty requestmessage = new httprequestmessageproperty();     requestmessage.headers["cookie"] = "myssocookie=myssocookievalue"; //ssocookie content     operationcontext.current.outgoingmessageproperties[httprequestmessageproperty.name] = requestmessage;     client.dosomething();  } 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -