Пример #1
0
 /** The factory for signature methods. */
 public static OAuthSignatureMethod newMethod(String name,
                                              OAuthAccessor accessor)
 {
     try
     {
         Type methodClass = NAME_TO_CLASS[name];
         if (methodClass != null)
         {
             OAuthSignatureMethod method = (OAuthSignatureMethod)Activator.CreateInstance(methodClass);
             method.initialize(name, accessor);
             return(method);
         }
         OAuthProblemException problem = new OAuthProblemException("signature_method_rejected");
         List <string>         todo    = new List <string>();
         foreach (var item in NAME_TO_CLASS.Keys)
         {
             todo.Add(item);
         }
         String acceptable = OAuth.percentEncode(todo);
         if (acceptable.Length > 0)
         {
             problem.setParameter("oauth_acceptable_signature_methods",
                                  acceptable);
         }
         throw problem;
     }
     catch (Exception e)
     {
         throw new OAuthException(e);
     }
 }