自定义WCF SharePoint中的FBA授权

时间:2013-11-10 18:46:04

标签: wcf sharepoint

我有肥皂WCF SharePoint:
[ServiceContract] public interface IService {

[OperationContract]
string Test();   

[OperationContract] string Test();

}

[BasicHttpBindingServiceMetadataExchangeEndpoint] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] public class Service : IService {

public string Test()
{
    WindowsIdentity identity = ServiceSecurityContext.Current.WindowsIdentity;

    ClaimsIdentity claimsIdentity = new ClaimsIdentity(identity);

    return SPContext.Current.Web.Title;
}
 }
  此服务映射到ISAPI.On SharePoint使用FBA。以及如何连接到冒充/验证FBA用户的WCF?

1 个答案:

答案 0 :(得分:0)

当启用windows和fba身份验证命令以使用Windows身份验证时,需要添加值为“f”的标题“X-FORMS_BASED_AUTH_ACCEPTED”:我使用restsharp:

 request.AddHeader("X-FORMS_BASED_AUTH_ACCEPTED", "f")