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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -