Пример #1
0
 public static void SignedKeyParamsParser(SupportedAuthScheme scheme, string parameter, NephosUriComponents uriComponents, out string accountName, out string signature)
 {
     NephosAssertionException.Assert(scheme.Equals(SupportedAuthScheme.SignedKey));
     NephosAssertionException.Assert((uriComponents == null ? false : !string.IsNullOrEmpty(uriComponents.AccountName)));
     if (string.IsNullOrEmpty(parameter))
     {
         CultureInfo invariantCulture = CultureInfo.InvariantCulture;
         object[]    objArray         = new object[] { "Authorization", string.Format("{0} {1}", scheme, parameter) };
         throw new InvalidAuthenticationInfoException(string.Format(invariantCulture, "{0} value '{1}' is invalid.", objArray));
     }
     accountName = uriComponents.AccountName;
     signature   = parameter;
 }
Пример #2
0
 public static void SharedKeyParamsParser(SupportedAuthScheme scheme, string parameter, NephosUriComponents uriComponents, out string accountName, out string signature)
 {
     NephosAssertionException.Assert((scheme.Equals(SupportedAuthScheme.SharedKey) ? true : scheme.Equals(SupportedAuthScheme.SharedKeyLite)));
     NephosAssertionException.Assert(!string.IsNullOrEmpty(parameter));
     string[] strArrays = parameter.Split(HttpRequestAccessorCommon.colonDelimiter, StringSplitOptions.RemoveEmptyEntries);
     if ((int)strArrays.Length != 2)
     {
         CultureInfo invariantCulture = CultureInfo.InvariantCulture;
         object[]    objArray         = new object[] { "Authorization", string.Format("{0} {1}", scheme, parameter) };
         throw new InvalidAuthenticationInfoException(string.Format(invariantCulture, "{0} value '{1}' is invalid.", objArray));
     }
     accountName = strArrays[0];
     signature   = strArrays[1];
 }