示例#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;
        }
示例#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; ;
        }
示例#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;
        }
示例#4
0
 public AuthorizationHeader(OAuthParameters oAuthParameters, string realm)
 {
     _oAuthParameters = oAuthParameters;
     _realm = realm;
 }
示例#5
0
 internal ParameterPart(Request request, OAuthParameters oAuthParameters)
 {
     _request         = request;
     _oAuthParameters = oAuthParameters;
 }
示例#6
0
		public SignatureBaseString(Request request, OAuthParameters oAuthParameters) {
			_request = request;
			_oAuthParameters = oAuthParameters;
		}
示例#7
0
		internal ParameterPart(Request request, OAuthParameters oAuthParameters) {
			_request = request;
			_oAuthParameters = oAuthParameters;
		}
示例#8
0
	    public AuthorizationHeader(OAuthParameters oAuthParameters, string realm, bool includeSession = false) {
			_oAuthParameters = oAuthParameters;
			_realm = realm;
		    _includeSession = includeSession;
		}