在Web api基本身份验证中针对后续请求发送用户凭据 [英] sending user credentials on subsequent requests in web api basic authentication

查看:111
本文介绍了在Web api基本身份验证中针对后续请求发送用户凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I'm working on a RESTful mobile application using ASP.Net Web APIs. I am inclined to use Basic authentication. I have followed some articles which gave me good start. I understood that "username:password" will be encoded and added to "Authorization: Basic " and sent it as header on subsequent http requests after authentication. But I have only one thing missing here is,
1.How do I send this "username:password" encoded string on every http request without using session or cookies
In Forms Authentication a cookie will be set. In membership User Principal will be set.
All http requests to web api comes from ajax and I need to set authorization header in beforeSend. But where do I get "username:password" encoded string from, on every page ajax request

推荐答案

帮助您充分满足需求
使用HTTP请求发送参数
security/basic-authentication [如何进行加密和解密 [ ^ ]
Follow both of article which will help you to make your requirement fullfil
Send Parameter using HTTP request
security/basic-authentication[^]
Encode your password
how-to-encrypt-and-decrypt[^]


这篇关于在Web api基本身份验证中针对后续请求发送用户凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆