odata 的表单身份验证或自定义标头身份验证哪个更好
我需要快速启动并运行它,但我花了最后几个小时研究/担心哪个会更好:
Asp.net 表单身份验证
与
自定义标头令牌:
在服务器上
protected override void OnStartProcessingRequest(ProcessRequestArgs args)
{
if (string.IsNullOrEmpty(WebOperationContext.Current.IncomingRequest.Headers.Get("magic")))
{
throw new DataServiceException(403, "Sorry No Magic found");
}
else
{
base.OnStartProcessingRequest(args);
}
}
在Windows Forms客户端上
static void datProvider_SendingRequest(object sender, SendingRequestEventArgs e)
{
e.RequestHeaders.Add("magic","HASHED_userbased_token");
}
注意事项:
- 我从未使用过表单身份验证(但我可以学习?)
- 用户注册很复杂(检查员工记录,然后根据这些记录创建用户)
- 我有我自己的自定义用户组/权限表/系统
- 没有SSL(客户端不关心这个事实,数据并不是那么有价值)
- 我似乎更能控制自定义标头。
I need this up and running quick but I spent the last few hours researching/worrying about which would be better:
Asp.net Forms Authentication
vs
Custom Header Token:
On the server
protected override void OnStartProcessingRequest(ProcessRequestArgs args)
{
if (string.IsNullOrEmpty(WebOperationContext.Current.IncomingRequest.Headers.Get("magic")))
{
throw new DataServiceException(403, "Sorry No Magic found");
}
else
{
base.OnStartProcessingRequest(args);
}
}
On the Windows Forms client
static void datProvider_SendingRequest(object sender, SendingRequestEventArgs e)
{
e.RequestHeaders.Add("magic","HASHED_userbased_token");
}
Considerations:
- I've never used forms auth (but I can learn?)
- The user registration is complex (Employee records are checked then users are created based on those)
- I have my own custom usergroups/permission tables/system
- There is no SSL (client doesnt care about this fact, data is not all that valuable)
- I seem like Im more in control with the custom header.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用自定义标头标记。表单身份验证假设人类将对服务进行身份验证,这在 OData 端点上发生是一件非常奇怪的事情。 OData 更多的是关于对 OData 服务进行身份验证的计算机或服务。
Use a custom header token. Forms auth assumes that a human will be authenticating to the service, which would be a pretty strange thing to happen on an OData end-point. OData is more about computers or services authenticating to the OData service.