public OAuthSignedParameterSet10(HttpParameterSet baseParams, StringGenerator random, Clock clock) : base(baseParams) { this.random = random; this.clock = clock; this.nonce = random.NextRandomString(NONCE_LENGTH); this.timeStamp = GetCurrentTimeStampString(); }
/// <summary> /// Create a new AuthorizationHeader based on OAuth keys and some /// HTTP request parameters required to generate correct OAuth signature. /// </summary> /// <param name="parameters">Parameters REQUIRED by OAuth</param> /// <returns>Instance of AuthorizationHeader</returns> public static AuthorizationHeader Create(HttpParameterSet parameters) { switch (parameters.OAuthVersion) { case "1.0": return new OAuthAuthorizationHeader10(parameters); default: string message = string.Format("Version {0} is not supported", parameters.OAuthVersion); throw new ApplicationException(message); } }
/// <summary> /// Create a new AuthorizationHeader based on OAuth keys and some /// HTTP request parameters required to generate correct OAuth signature. /// </summary> /// <param name="parameters">Parameters REQUIRED by OAuth</param> /// <returns>Instance of AuthorizationHeader</returns> public static AuthorizationHeader Create(HttpParameterSet parameters) { switch (parameters.OAuthVersion) { case "1.0": return(new OAuthAuthorizationHeader10(parameters)); default: string message = string.Format("Version {0} is not supported", parameters.OAuthVersion); throw new ApplicationException(message); } }
/// <summary> /// A copy constructor /// </summary> /// <param name="another">Another instance</param> public HttpParameterSet(HttpParameterSet another) { SetDefaultValue(); Url = another.Url; RequestMethod = another.RequestMethod; PostData = another.PostData; OAuthVersion = another.OAuthVersion; ConsumerKey = another.ConsumerKey; ConsumerSecret = another.ConsumerSecret; Token = another.Token; TokenSecret = another.TokenSecret; SignatureMethod = another.SignatureMethod; }
public SignedParameterSet(HttpParameterSet baseParams) : base(baseParams) { }
private void SetUpGet() { httpGetParam = new HttpParameterSet() { ConsumerKey = "consumerKey", ConsumerSecret = "consumerSecret", Token = "token", TokenSecret = "tokenSecret", OAuthVersion = "1.0", RequestMethod = "GET", SignatureMethod = "HMAC-SHA1", Url = "http://www.gant.com/test?first=value1&second=value2" }; fixedStringGet = new FixedStringGenerator(GET_NONCE); fixedClockGet = new FixedClock(GET_TIMESTAMP); signedGetRequest = new OpenedSignedParameterSet10(httpGetParam, fixedStringGet, fixedClockGet); }
public OpenedSignedParameterSet10(HttpParameterSet http, StringGenerator str, Clock clock) : base(http, str, clock) { }
/// <summary> /// Dependency on SignedParamterSet, RandomString, and Clock. /// </summary> /// <param name="baseParams">Parameters to pass to ctor of SignedParameterSet</param> /// <returns></returns> protected virtual SignedParameterSet CreateSignedParameterSet(HttpParameterSet baseParams) { return new OAuthSignedParameterSet10(baseParams, new RandomStringGenerator(), new SystemClock()); }
public OAuthAuthorizationHeader10(HttpParameterSet parameters) { this.parameters = CreateSignedParameterSet(parameters); }
/// <summary> /// Dependency on SignedParamterSet, RandomString, and Clock. /// </summary> /// <param name="baseParams">Parameters to pass to ctor of SignedParameterSet</param> /// <returns></returns> protected virtual SignedParameterSet CreateSignedParameterSet(HttpParameterSet baseParams) { return(new OAuthSignedParameterSet10(baseParams, new RandomStringGenerator(), new SystemClock())); }