/core/externals/update-engine/externals/gdata-objectivec-client/Source/Networking/GDataAuthenticationFetcher.h

http://macfuse.googlecode.com/ · C++ Header · 66 lines · 11 code · 5 blank · 50 comment · 0 complexity · 283d9fcfe776785bce60bc0d88ad89ef MD5 · raw file

  1. /* Copyright (c) 2009 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. //
  16. // GDataAuthenticationFetcher.h
  17. //
  18. #import "GTMHTTPFetcher.h"
  19. @interface GDataAuthenticationFetcher : NSObject
  20. // authTokenFetcherWithUsername: returns a GDataHTTPFetcher for obtaining a
  21. // response with Google's ClientLogin protocol
  22. //
  23. // Protocol docs: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
  24. //
  25. // serviceID is the code for the service to be used, such as
  26. // [GDataServiceGoogleCalendar serviceID]
  27. // source is the app's identifier, in the form companyName-applicationName-versionID
  28. // domain should be nil to authenticate against www.google.com; it may be
  29. // localhost:n for unit testing to port n
  30. // params is a dictionary with additional parameters for the post body
  31. // headers are custom headers to be added to the request; typically this is nil
  32. //
  33. // The params dictionary may be used to specify a captcha response, as in
  34. // NSDictionary *params = nil;
  35. // if ([captchaToken length] > 0 && [captchaAnswer length] > 0) {
  36. // params = [NSDictionary dictionaryWithObjectsAndKeys:
  37. // captchaToken, @"logintoken",
  38. // captchaAnswer, @"logincaptcha", nil];
  39. // }
  40. //
  41. // The user should invoke the fetcher's beginFetchWithDelegate: method
  42. // and provide the callbacks, consistent with the GDataHTTPFetcher
  43. // conventions.
  44. //
  45. // The callback data may be parsed with +dictionaryWithResponseData
  46. // from GDataUtilities, as in
  47. //
  48. // - (void)authFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *)error {
  49. // if (error == nil) {
  50. // NSDictionary *responseDict = [GDataUtilities dictionaryWithResponseData:data];
  51. // ...
  52. //
  53. + (GTMHTTPFetcher *)authTokenFetcherWithUsername:(NSString *)username
  54. password:(NSString *)password
  55. service:(NSString *)serviceID
  56. source:(NSString *)source
  57. signInDomain:(NSString *)domain
  58. accountType:(NSString *)accountType
  59. additionalParameters:(NSDictionary *)params
  60. customHeaders:(NSDictionary *)headers;
  61. @end