加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flash URLRequest 权限认证

发布时间:2020-12-15 20:10:30 所属栏目:百科 来源:网络整理
导读:HTTP权限认证的基本概念 https://en.wikipedia.org/wiki/Basic_access_authentication 添加认证头信息 var?encoder:Base64Encoder?=?new?Base64Encoder();encoder.encode(username?+?':'?+?password);var?req:URLRequest?=?new?URLRequest();req.requestHead

HTTP权限认证的基本概念

https://en.wikipedia.org/wiki/Basic_access_authentication


添加认证头信息

var?encoder:Base64Encoder?=?new?Base64Encoder();
encoder.encode(username?+?':'?+?password);
var?req:URLRequest?=?new?URLRequest();
req.requestHeaders.push(new?URLRequestHeader("Authorization",?"Basic?"?+?encoder.toString()));


flash中使用URLRequest仅支持在POST下提交自定义header,flash令人很烦的地方,下面链接中使用了变通的方法即socket,但这样在开发环境下就很难捕捉到http消息(Fiddler中无法抓到http请求消息)

http://stackoverflow.com/questions/490806/http-basic-authentication-with-httpservice-objects-in-adobe-flex-air


去除http认证时,网页弹出认证输入框(未经验证)

http://stackoverflow.com/questions/404199/how-can-i-avoid-an-authentication-dialog-in-flex-when-using-httpservice-or-urlre


综上,flash底层的网络接口的确是有诸多限制(安全沙箱冲突,只支持POST,GET,GET时无法自定义header)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读