Authentication in WCF for every call

前端 未结 2 1530
野的像风
野的像风 2021-01-22 12:34

I\'m consuming a lot of WCF Services from a Silverlight application in a totally disconnected-way.

I want to ensure that I know the user who is calling every service and

2条回答
  •  被撕碎了的回忆
    2021-01-22 13:27

    One way to do this is if you can impersonate all users for that You need to add following in your service behaviour

       
    

    more details here http://msdn.microsoft.com/en-us/library/ms731090.aspx

    and if you want to know the user then inside your service methods you can use

     System.Threading.Thread.CurrentPrincipal.Identity.Name
    

    to find the user name who is using your services

    Edit:

    You can use membership api details here

    http://msdn.microsoft.com/en-us/library/ms731049.aspx

    http://blogs.msdn.com/b/pedram/archive/2007/10/05/wcf-authentication-custom-username-and-password-validator.aspx

    http://social.msdn.microsoft.com/forums/en-US/asmxandxml/thread/8a679fb2-e67e-44a9-b491-eb95d5144068

提交回复
热议问题