예제 #1
0
        public void PINを取得するためのトークンを取得するためのシグニチャ()
        {
            OAuth.OAuthBase oauth = new TestingOAuth( "1281614602", "8715791" );

            OAuthConsumer consumer = new OAuthConsumer( ConsumerKey, ConsumerSecret );

            Uri uri = new Uri( ReqestToken );
            string signature = oauth.GenerateSignature( uri, consumer, "GET", "" );

            Assert.AreEqual( "FOBRl2mkgAx9tNdQeNIiIxjwhxo=", signature );
            Assert.AreEqual( "oauth_consumer_key=OKWyYVPvnpcBfbdmrJaNWx&oauth_nonce=8715791&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1281614602&oauth_version=1.0",
                oauth.NormalizedRequestParameters );
        }
예제 #2
0
        public void PINを取得後の認証のためのシグニチャ()
        {
            string pin = "0011696";

            OAuth.OAuthBase oauth = new TestingOAuth( "1281614602", "8715791" );

            OAuth.OAuthConsumer consumer = new OAuthConsumer( ConsumerKey, ConsumerSecret );
            consumer.SetTokenWithSecret( "021d4561687d6c5d328ad5b491624f30", "552ae19dc6f2b7736db9678bb4de2f00" );

            Uri uri = new Uri( AccessToken );
            string signature = oauth.GenerateSignature( uri, consumer, "POST", pin );

            Assert.AreEqual( "w9XSZS9loX/pyz6DtO2Q04QmDAw=", signature );
            Assert.AreEqual( "oauth_consumer_key=OKWyYVPvnpcBfbdmrJaNWx&oauth_nonce=8715791&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1281614602&oauth_token=021d4561687d6c5d328ad5b491624f30&oauth_verifier=0011696&oauth_version=1.0",
                oauth.NormalizedRequestParameters );
        }
예제 #3
0
        public void データ取得のためのシグニチャ()
        {
            const string Diagrams = "http://cacoo.com/api/v1/diagrams.xml";

            OAuth.OAuthBase oauth = new TestingOAuth( "1281615317", "2677625" );

            OAuthConsumer consumer = new OAuthConsumer( ConsumerKey, ConsumerSecret );
            consumer.SetTokenWithSecret( "f1b3a9fdb759dbd0c1818f7cdef307c0", "2e55a9ea2e9c286abfedadffecf15f74" );

            Uri uri = new Uri( Diagrams );
            string signature = oauth.GenerateSignature( uri, consumer, "POST", "" );

            Assert.AreEqual( "YRhAaq8P+fN4DgkFhaF6x+EH1qA=", signature );
            Assert.AreEqual( "oauth_consumer_key=\"OKWyYVPvnpcBfbdmrJaNWx\", oauth_nonce=\"2677625\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1281615317\", oauth_token=\"f1b3a9fdb759dbd0c1818f7cdef307c0\", oauth_version=\"1.0\", oauth_signature=\"YRhAaq8P%2BfN4DgkFhaF6x%2BEH1qA%3D\"",
                oauth.AuthorizationRequestParameters );
        }