c# - How to secure Web services in ASMX file? -


i have critical db connection done through web service .asmx file accessible , can open through direct browse through browser how prevent methods , allow methods access general unauthenticated users?

this problem severe application.

one common method use access token in web service calls. scenario this:

  1. user calls "login" web service method, passing credentials. (this should on secure connection, might want require ssl this, if don't of them.)
  2. the "login" web service method authenticates user, generates access token (a guid works nicely), stores access token (perhaps window of time token usable), , returns token user in response.
  3. all subsequent web service methods (everything needs secured) requires access token provided method argument. user passes access token in of calls.
  4. each time web service method called, system validates access token against known generated tokens (accounting window of time, if want tokens expire, recommend) and, if it's not valid token, denies request.

if you've ever used facebook api, that's 1 common example of needing request time-sensitive access token in order make subsequent api calls.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -