WCF Service authorization patterns

后端 未结 3 533
名媛妹妹
名媛妹妹 2020-12-31 20:07

I\'m implementing a secure WCF service. Authentication is done using username / password or Windows credentials. The service is hosted in a Windows Service process. Now, I\'

3条回答
  •  余生分开走
    2020-12-31 20:50

    For question 1, it's best to perform authorization first. That way, you don't leak validation error messages back to unauthorized users.

    BTW, instead of using a home-grown authentication method (which I assume is what your CheckAccessPermission is), you might be able to hook up to WCF's out-of-the-box support for ASP.NET role providers. Once this is done, you perform authorization via OperationContext.Current.ServiceSecurityContext.PrimaryIdentity.IsInRole(). The PrimaryIdentity is an IPrincipal.

提交回复
热议问题