dojo.provide("dojox.io.OAuth"); dojo.require("dojox.encoding.digests.SHA1"); dojox.io.OAuth = new (function(){ // summary: // Helper singleton for signing any kind of Ajax request using the OAuth 1.0 protocol. // description: // dojox.io.OAuth is a singleton class designed to allow anyone to sign a request, // based on the OAuth 1.0 specification, made with any of the Dojo Toolkit's Ajax // methods (such as dojo.xhr[verb], dojo.io.iframe, etc.). // // The main method of dojox.io.OAuth is the sign method (see documentation for .sign); // the idea is that you will "sign" the kwArgs object you'd normally pass to any of // the Ajax methods, and then pass the signed object along. As long as the token // object used is valid (and the client's date and time are synced with a public // time server), a signed object should be passed along correctly. // // dojox.io.OAuth does not deal with the OAuth handshake process at all. // // This object was developed against the Netflix API (OAuth-based service); see // http://developer.netflix.com for more details. var encode = this.encode = function(s){ if(!s){ return ""; } return encodeURIComponent(s) .replace(/\!/g, "%21") .replace(/\*/g, "%2A") .replace(/\'/g, "%27") .replace(/\(/g, "%28") .replace(/\)/g, "%29"); }; var decode = this.decode = function(str){ // summary: // Break apart the passed string and decode. // Some special cases are handled. var a=[], list=str.split("&"); for(var i=0, l=list.length; i-1){ a=a.substring(0, a.lastIndexOf(":")); } } var path=map.path||"/"; map.url=p+"://"+a+path; // return the map return map; } var tab="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; function nonce(length){ var s="", tl=tab.length; for(var i=0; ib[0]){ return 1; } if(a[0]b[1]){ return 1; } if(a[1]