PageRenderTime 50ms CodeModel.GetById 45ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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//
17//  GDataAuthenticationFetcher.h
18//
19
20#import "GTMHTTPFetcher.h"
21
22@interface GDataAuthenticationFetcher : NSObject
23
24// authTokenFetcherWithUsername: returns a GDataHTTPFetcher for obtaining a
25// response with Google's ClientLogin protocol
26//
27// Protocol docs: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html
28//
29// serviceID is the code for the service to be used, such as
30//   [GDataServiceGoogleCalendar serviceID]
31// source is the app's identifier, in the form companyName-applicationName-versionID
32// domain should be nil to authenticate against www.google.com; it may be
33//   localhost:n for unit testing to port n
34// params is a dictionary with additional parameters for the post body
35// headers are custom headers to be added to the request; typically this is nil
36//
37// The params dictionary may be used to specify a captcha response, as in
38//    NSDictionary *params = nil;
39//    if ([captchaToken length] > 0 && [captchaAnswer length] > 0) {
40//      params = [NSDictionary dictionaryWithObjectsAndKeys:
41//                                        captchaToken, @"logintoken",
42//                                        captchaAnswer, @"logincaptcha", nil];
43//    }
44//
45// The user should invoke the fetcher's beginFetchWithDelegate: method
46// and provide the callbacks, consistent with the GDataHTTPFetcher
47// conventions.
48//
49// The callback data may be parsed with +dictionaryWithResponseData
50// from GDataUtilities, as in
51//
52// - (void)authFetcher:(GTMHTTPFetcher *)fetcher finishedWithData:(NSData *)data error:(NSError *)error {
53//   if (error == nil) {
54//     NSDictionary *responseDict = [GDataUtilities dictionaryWithResponseData:data];
55//     ...
56//
57
58+ (GTMHTTPFetcher *)authTokenFetcherWithUsername:(NSString *)username
59                                        password:(NSString *)password
60                                         service:(NSString *)serviceID
61                                          source:(NSString *)source
62                                    signInDomain:(NSString *)domain
63                                     accountType:(NSString *)accountType
64                            additionalParameters:(NSDictionary *)params
65                                   customHeaders:(NSDictionary *)headers;
66@end