Best guidance for One time user authentication & wcf service -


i new in wcf service , have seen people send user credential when made function call of wcf service below way.

private static void main(string[] args)  {     servicepointmanager.servercertificatevalidationcallback = new remotecertificatevalidationcallback(          delegate { return true; });       var client = new wcfserviceclient();      client.clientcredentials.username.username = username;      client.clientcredentials.username.password = password;      console.write(client.getdata(1));      client.close();      console.read();  } 

i want pass user credential once , after authentication user can call service function many time without credentials. guide me how design kind of service. looking small sample code me learn & implement. thanks

you need enable sessions on service , client can establish session service. can happen while same channel used communicate service.

in above code, example, session terminated when called close().

in order establish security context once , re-use need establish secure session, means security token retrieved once , used repeatedly subsequent operation calls.

however available bindings, , not work basichttpbinding.

update

the second link posted outlines 2 different ways expose service secure session. unfortunately client code not included in article.

the client code can either generated using svcutil.exe (or add service reference in vs), or can use wcf channel stack create client on on fly using assembly containing service operation , data contract definitions.

if configure secure session in <system.servicemodel/> configuration section using 1 of standard wcf bindings, binding configuration can copied , pasted client config , necessary client use secure sessions.

so wcf stack handles you. hope clear.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -