Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.ossnetworks.net.rtmp
- {
- import com.adobe.crypto.MD5;
- import com.adobe.crypto.HMAC;
- import flash.net.NetConnection;
- import net.zedia.utils.StringUtils;
- public class AuthorizedNetConnection extends NetConnection
- {
- private var username:String;
- private var password:String;
- [Bindable] public var isAuthorized:Boolean=false;
- public function AuthorizedNetConnection(_username:String,_password:String)
- {
- this.username=_username;
- this.password=_password;
- super();
- }
- public function authorize():void{
- this.isAuthorized=true;
- this.dispatchEvent(new NetConnectionAuthorizeEvent(NetConnectionAuthorizeEvent.NCA_AUTHORIZED));
- }
- public function remoteErrorProxy(e:*):void{
- var e:Error = new Error(e);
- throw e;
- }
- public function nonceAuth(ronce:String):String{
- /*
- Auth pattern corresponds to a poor mans` implementation of noonce algo used in SIP sessions.
- we construct the string using ronce provided by server
- Hash it with md5 and return to server
- */
- trace('----------------------------------------------')
- trace(this.username+' '+HMAC.hash(this.password,ronce))
- trace('----------------------------------------------')
- return this.username+' '+HMAC.hash(this.password,ronce)
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement