Esempio n. 1
0
        public string CreateSignature(X509Certificate2 certificate, IToken token, Uri uri, string verb,
            string verifier = null, bool renewToken = false, string callback = null)
        {
            var oAuthParameters = new OAuthParameters(
                new ConsumerKey(token.ConsumerKey),

                //Modified to fix oauth error for private app
                //new TokenKey(token.TokenKey),
                new TokenKey(token.ConsumerKey),

                "RSA-SHA1",
                new DefaultTimestampSequence(),
                new DefaultNonceSequence(),
                string.Empty,
                "1.0",
                verifier,
                token.Session,
                renewToken,
                callback);

            var signatureBaseString =
                new SignatureBaseString(
                    new Request
                    {
                        Url = uri,
                        Verb = verb
                    },
                    oAuthParameters);

            var signature = new RsaSha1(certificate).Sign(signatureBaseString);

            oAuthParameters.SetSignature(signature);

            return new AuthorizationHeader(oAuthParameters, string.Empty, renewToken).Value;
        }
Esempio n. 2
0
        public string CreateSignature(X509Certificate2 certificate, IToken token, Uri uri, string verb, string verifier = null)
        {
            var oAuthParameters = new OAuthParameters(
                new ConsumerKey(token.ConsumerKey),
                new TokenKey(token.ConsumerKey),
                "RSA-SHA1",
                new DefaultTimestampSequence(),
                new DefaultNonceSequence(),
                string.Empty,
                "1.0",
                verifier,
                token.Session);

            var signatureBaseString =
                new SignatureBaseString(
                    new Request
                    {
                        Url = uri,
                        Verb = verb
                    },
                    oAuthParameters);

            var signature = new RsaSha1(certificate).Sign(signatureBaseString);

            oAuthParameters.SetSignature(signature);

            return new AuthorizationHeader(oAuthParameters, string.Empty).Value; ;
        }
Esempio n. 3
0
        public string CreateSignature(IToken token, Uri uri, string verb, string verifier = null, string callback = null)
        {
            var oAuthParameters = new OAuthParameters(
                new ConsumerKey(token.ConsumerKey),
                new TokenKey(token.TokenKey),
                "HMAC-SHA1",
                new DefaultTimestampSequence(),
                new DefaultNonceSequence(),
                string.Empty,
                "1.0",
                verifier,
                token.Session, false, callback);

            var signatureBaseString =
                new SignatureBaseString(
                    new Request
                    {
                        Url = uri,
                        Verb = verb
                    },
                    oAuthParameters);

            var signature = new HmacSha1().Sign(signatureBaseString, token.ConsumerSecret, token.TokenSecret);

            oAuthParameters.SetSignature(signature);

            return new AuthorizationHeader(oAuthParameters, string.Empty).Value;
        }
Esempio n. 4
0
 public AuthorizationHeader(OAuthParameters oAuthParameters, string realm)
 {
     _oAuthParameters = oAuthParameters;
     _realm = realm;
 }
Esempio n. 5
0
 internal ParameterPart(Request request, OAuthParameters oAuthParameters)
 {
     _request         = request;
     _oAuthParameters = oAuthParameters;
 }
Esempio n. 6
0
		public SignatureBaseString(Request request, OAuthParameters oAuthParameters) {
			_request = request;
			_oAuthParameters = oAuthParameters;
		}
Esempio n. 7
0
		internal ParameterPart(Request request, OAuthParameters oAuthParameters) {
			_request = request;
			_oAuthParameters = oAuthParameters;
		}
Esempio n. 8
0
	    public AuthorizationHeader(OAuthParameters oAuthParameters, string realm, bool includeSession = false) {
			_oAuthParameters = oAuthParameters;
			_realm = realm;
		    _includeSession = includeSession;
		}