我一直在尝试基于Sql Azure提供身份验证的实体框架模型实现OData服务。我在数据库中提供行/列访问。OData身份验证
我希望能够从LinqPad,Excel等称为安全服务。
我已经尝试了standard series中定义的各种方案,但即使返回401,Excel或LinqPad都不会记录用户输入的用户名和密码。
所以,我想我会让用户名/密码成为查询参数(通过SSL)。但事实证明,这也是非法的(OData需要格式良好的URL,而且没有查询参数)。
于是我想,为什么不使用WebGet嵌入在URL中的用户名和密码,但我不能得到这与WCF中的OData源格式的工作:
<%@ ServiceHost的语言= “C#” 厂= “System.Data.Services.DataServiceHostFactory,System.Data.Services,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089” 服务= “WebApplication5.OData” %>
public class OData : DataService<MyEntities>
{
public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
protected override MyEntities CreateDataSource()
{
// create the OData source with the user name and password here
}
}
有没有人真的有OData工作的用户名和密码传递到源?