├── .gitignore ├── .gitmodules ├── LICENSE ├── Other Sources └── SSOAuthKit_Prefix.pch ├── Readme.markdown ├── Resources └── SSOAuthKit.bundle │ └── images │ └── twitter_oauth_background.png ├── SSOAuthKit.xcodeproj └── project.pbxproj ├── SSOAuthKit ├── NSDictionary+oaCompareKeys.h ├── NSDictionary+oaCompareKeys.m ├── NSURL+OAuthString.h ├── NSURL+OAuthString.m ├── SSOAConsumer.h ├── SSOAConsumer.m ├── SSOAFormRequest.h ├── SSOAFormRequest.m ├── SSOARequest.h ├── SSOARequest.m ├── SSOAToken.h ├── SSOAToken.m ├── SSOAuthKit.h ├── SSOAuthKitConfiguration.h ├── SSOAuthKitConfiguration.m ├── SSTwitterAuthViewController.h ├── SSTwitterAuthViewController.m ├── SSTwitterAuthViewControllerDelegate.h ├── SSTwitterOAuthViewController.h ├── SSTwitterOAuthViewController.m ├── SSTwitterXAuthViewController.h ├── SSTwitterXAuthViewController.m └── Vendor │ └── OAuthConsumer │ ├── Base64Transcoder.c │ ├── Base64Transcoder.h │ ├── OAHMAC_SHA1SignatureProvider.h │ ├── OAHMAC_SHA1SignatureProvider.m │ └── OASignatureProviding.h └── TwitterDemo ├── Classes ├── TwitterDemoAppDelegate.h ├── TwitterDemoAppDelegate.m ├── TwitterDemoViewController.h └── TwitterDemoViewController.m ├── TwitterDemo-Info.plist ├── TwitterDemo.xcodeproj └── project.pbxproj ├── TwitterDemo_Prefix.pch └── main.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build 3 | *.mode1v3 4 | *.pbxuser 5 | xcuserdata 6 | project.xcworkspace 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "SSOAuthKit/Vendor/ASIHTTPRequest"] 2 | path = SSOAuthKit/Vendor/ASIHTTPRequest 3 | url = http://github.com/pokeb/asi-http-request.git 4 | [submodule "SSOAuthKit/Vendor/yajl-objc"] 5 | path = SSOAuthKit/Vendor/yajl-objc 6 | url = http://github.com/gabriel/yajl-objc.git 7 | [submodule "SSOAuthKit/Vendor/SSToolkit"] 8 | path = SSOAuthKit/Vendor/SSToolkit 9 | url = http://github.com/samsoffes/sstoolkit.git 10 | [submodule "SSOAuthKit/Vendor/json-framework"] 11 | path = SSOAuthKit/Vendor/json-framework 12 | url = http://github.com/stig/json-framework.git 13 | [submodule "SSOAuthKit/Vendor/JSON"] 14 | path = SSOAuthKit/Vendor/JSON 15 | url = http://github.com/samsoffes/json-framework.git 16 | [submodule "SSOAuthKit/Vendor/JSONKit"] 17 | path = SSOAuthKit/Vendor/JSONKit 18 | url = git://github.com/johnezang/JSONKit.git 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010 Sam Soffes 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /Other Sources/SSOAuthKit_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAuthKit_Prefix.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 11/17/09. 6 | // Copyright 2009-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #ifdef __OBJC__ 10 | #import 11 | #endif 12 | -------------------------------------------------------------------------------- /Readme.markdown: -------------------------------------------------------------------------------- 1 | This library is very old. I recommend using [SimpleAuth](https://github.com/calebd/simpleauth) instead. 2 | 3 | --- 4 | 5 | # SSOAuthKit 6 | 7 | SSOAuthKit was designed to making interacting with OAuth 1.0 services as painless as possible. (If you are looking for an OAuth 2.0 client, check out [LROAuth2Client](http://github.com/lukeredpath/lroauth2client).) 8 | 9 | ## Configuration 10 | 11 | Having include a header file with your consumer credentials is kind of a pain. Different applications manage their constants different. SSOAuthKit is flexible. You just have to call the following method once to setup your credentials. 12 | 13 | ```objective-c 14 | [SSOAuthKitConfiguration setConsumerKey:@"CONSUMER_KEY_GOES_HERE" secret:@"CONSUMER_SECRET_GOES_HERE"]; 15 | ``` 16 | 17 | Done. Simple as that. 18 | 19 | ## Making Requests 20 | 21 | SSOAuthKit's core is `SSOARequest` and `SSOAFormRequest` which are subclasses of `ASIHTTPRequest`. You just simply set a token like this: 22 | 23 | ```objective-c 24 | SSOARequest *request = [[SSOARequest alloc] initWithURL:someUrl]; 25 | request.token = yourToken; 26 | [request startAsynchronous]; 27 | [request release]; 28 | ``` 29 | 30 | ## Twitter 31 | 32 | The main goal of SSOAuthKit was to make authenticating with Twitter stupid easy. There is a handy class called `SSTwitterOAuthViewController` that handles *everything* for you. You can have your application setup on Twitter to do the pin style verification or the redirect style verification. (If you do the redirect style, the redirect is stopped and verified by the library. You are responsible for forwarding the message to your server.) Pin style is recommended. Just present it as a modal: 33 | 34 | ```objective-c 35 | SSTwitterOAuthViewController *viewController = [[SSTwitterOAuthViewController alloc] initWithDelegate:self]; 36 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 37 | navigationController.modalPresentationStyle = UIModalPresentationFormSheet; 38 | [self presentModalViewController:navigationController animated:YES]; 39 | [viewController release]; 40 | [navigationController release]; 41 | ``` 42 | 43 | You can of course, do it however you want though. 44 | 45 | `SSTwitterAuthViewController` has three optional delegate methods: 46 | 47 | ```objective-c 48 | - (void)twitterAuthViewControllerDidCancel:(UIViewController *)viewController; 49 | - (void)twitterAuthViewController:(UIViewController *)viewController didFailWithError:(NSError *)error; 50 | - (void)twitterAuthViewController:(UIViewController *)viewController didAuthorizeWithAccessToken:(SSOAToken *)accessToken userDictionary:(NSDictionary *)userDictionary; 51 | ``` 52 | 53 | So if something fails, you get an error that you can handle. If it succeeds, you got their access token and an NSDictionary of their user from Twitter. 54 | 55 | ### xAuth 56 | 57 | Twitter's [xAuth](http://dev.twitter.com/pages/xauth) is also supported. To use, implement the same delegates and use the following code to present the modal: 58 | 59 | ```objective-c 60 | SSTwitterXAuthViewController *viewController = [[SSTwitterXAuthViewController alloc] initWithDelegate:self]; 61 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 62 | navigationController.modalPresentationStyle = UIModalPresentationFormSheet; 63 | [self presentModalViewController:navigationController animated:YES]; 64 | [viewController release]; 65 | [navigationController release]; 66 | ``` 67 | 68 | The [demo app](https://github.com/samsoffes/ssoauthkit/tree/master/TwitterDemo) has examples of both methods. 69 | 70 | ## Adding SSOAuthKit (and SSToolkit) to your project 71 | 72 | SSOAuthKit depends on SSToolkit. Adding SSOAuthKit will add SSToolkit (as well as ASIHTTPRequest and yajl-objc) to your project. 73 | 74 | 1. Run the following command to add the submodule. Be sure you have been added to the project on GitHub. 75 | 76 | git submodule add --recursive git://github.com/samsoffes/ssoauthkit.git Frameworks/SSOAuthKit 77 | 78 | 2. In Finder, navigate to the `Frameworks/SSOAuthKit` folder and drag the `xcodeproj` file into the `Frameworks` folder in your Xcode project. 79 | 80 | 3. In Finder, drag `SSOAuthKit.bundle` located in `Frameworks/SSOAuthKit/Resources` into the `Resources` folder in your Xcode project. 81 | 82 | 4. In Finder, drag `SSToolkit.bundle` located in `Frameworks/SSOAuthKit/SSOAuthKit/Vendor/SSToolkit/Resources` into the `Resources` folder in your Xcode project. 83 | 84 | 5. Select the SSOAuthKit Xcode project from the sidebar in Xcode. In the file browser on the right in Xcode, click the checkbox next to `libSSOAuthKit.a`. (If you don't see the file browser, hit Command-Shift-E to toggle it on.) 85 | 86 | 6. Select your target from the sidebar and open Get Info (Command-I). 87 | 88 | 7. Choose the *General* tab from the top. 89 | 90 | 8. Under the *Direct Dependencies* area, click the plus button, select *SSOAuthKit* from the menu, and choose *Add Target*. 91 | 92 | 9. Choose the build tab from the top of the window. Make sure the configuration dropdown at the top is set to *All Configurations*. 93 | 94 | 9. Add `Frameworks/SSOAuthKit` to *Header Search Path* and click the *Recursive* checkbox. 95 | 96 | 10. Add `-all_load -ObjC` to *Other Linker Flags*. 97 | -------------------------------------------------------------------------------- /Resources/SSOAuthKit.bundle/images/twitter_oauth_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soffes/ssoauthkit/8926f5f41a832e4e15a555bcbf8da3386184743a/Resources/SSOAuthKit.bundle/images/twitter_oauth_background.png -------------------------------------------------------------------------------- /SSOAuthKit.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B202D4651348D35A00C389A8 /* JSONKit.h in Headers */ = {isa = PBXBuildFile; fileRef = B202D4621348D35A00C389A8 /* JSONKit.h */; }; 11 | B202D4661348D35A00C389A8 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = B202D4631348D35A00C389A8 /* JSONKit.m */; }; 12 | B24ED8C6138C790F00FACB48 /* SSTwitterXAuthViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B24ED8C4138C790F00FACB48 /* SSTwitterXAuthViewController.h */; }; 13 | B24ED8C7138C790F00FACB48 /* SSTwitterXAuthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24ED8C5138C790F00FACB48 /* SSTwitterXAuthViewController.m */; }; 14 | B24ED8CE138C79CF00FACB48 /* SSTwitterAuthViewControllerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B24ED8CD138C79CF00FACB48 /* SSTwitterAuthViewControllerDelegate.h */; }; 15 | B24ED8DA138C7A9B00FACB48 /* SSTwitterAuthViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B24ED8D8138C7A9B00FACB48 /* SSTwitterAuthViewController.h */; }; 16 | B24ED8DB138C7A9B00FACB48 /* SSTwitterAuthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B24ED8D9138C7A9B00FACB48 /* SSTwitterAuthViewController.m */; }; 17 | B27E1B2611F0D5E000165C54 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B2511F0D5E000165C54 /* CFNetwork.framework */; }; 18 | B27E1B2811F0D5E000165C54 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B2711F0D5E000165C54 /* CoreGraphics.framework */; }; 19 | B27E1B2A11F0D5E000165C54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B2911F0D5E000165C54 /* Foundation.framework */; }; 20 | B27E1B2C11F0D5E000165C54 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B2B11F0D5E000165C54 /* MobileCoreServices.framework */; }; 21 | B27E1B2E11F0D5E000165C54 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B2D11F0D5E000165C54 /* QuartzCore.framework */; }; 22 | B27E1B3011F0D5E000165C54 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B2F11F0D5E000165C54 /* SystemConfiguration.framework */; }; 23 | B27E1B3211F0D5E000165C54 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B3111F0D5E000165C54 /* UIKit.framework */; }; 24 | B27E1B3411F0D5E000165C54 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B27E1B3311F0D5E000165C54 /* libz.dylib */; }; 25 | B29851E611F0D865008B1A4A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B29851E511F0D865008B1A4A /* Security.framework */; }; 26 | B2CBDA5D1348D520009DDE4D /* ASIAuthenticationDialog.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA051348D520009DDE4D /* ASIAuthenticationDialog.h */; }; 27 | B2CBDA5E1348D520009DDE4D /* ASIAuthenticationDialog.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA061348D520009DDE4D /* ASIAuthenticationDialog.m */; }; 28 | B2CBDA5F1348D520009DDE4D /* ASICacheDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA071348D520009DDE4D /* ASICacheDelegate.h */; }; 29 | B2CBDA601348D520009DDE4D /* ASIDataCompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA081348D520009DDE4D /* ASIDataCompressor.h */; }; 30 | B2CBDA611348D520009DDE4D /* ASIDataCompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA091348D520009DDE4D /* ASIDataCompressor.m */; }; 31 | B2CBDA621348D520009DDE4D /* ASIDataDecompressor.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA0A1348D520009DDE4D /* ASIDataDecompressor.h */; }; 32 | B2CBDA631348D520009DDE4D /* ASIDataDecompressor.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA0B1348D520009DDE4D /* ASIDataDecompressor.m */; }; 33 | B2CBDA641348D520009DDE4D /* ASIDownloadCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA0C1348D520009DDE4D /* ASIDownloadCache.h */; }; 34 | B2CBDA651348D520009DDE4D /* ASIDownloadCache.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA0D1348D520009DDE4D /* ASIDownloadCache.m */; }; 35 | B2CBDA661348D520009DDE4D /* ASIFormDataRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA0E1348D520009DDE4D /* ASIFormDataRequest.h */; }; 36 | B2CBDA671348D520009DDE4D /* ASIFormDataRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA0F1348D520009DDE4D /* ASIFormDataRequest.m */; }; 37 | B2CBDA681348D520009DDE4D /* ASIHTTPRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA101348D520009DDE4D /* ASIHTTPRequest.h */; }; 38 | B2CBDA691348D520009DDE4D /* ASIHTTPRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA111348D520009DDE4D /* ASIHTTPRequest.m */; }; 39 | B2CBDA6A1348D520009DDE4D /* ASIHTTPRequestConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA121348D520009DDE4D /* ASIHTTPRequestConfig.h */; }; 40 | B2CBDA6B1348D520009DDE4D /* ASIHTTPRequestDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA131348D520009DDE4D /* ASIHTTPRequestDelegate.h */; }; 41 | B2CBDA6C1348D520009DDE4D /* ASIInputStream.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA141348D520009DDE4D /* ASIInputStream.h */; }; 42 | B2CBDA6D1348D520009DDE4D /* ASIInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA151348D520009DDE4D /* ASIInputStream.m */; }; 43 | B2CBDA6E1348D520009DDE4D /* ASINetworkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA161348D520009DDE4D /* ASINetworkQueue.h */; }; 44 | B2CBDA6F1348D520009DDE4D /* ASINetworkQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA171348D520009DDE4D /* ASINetworkQueue.m */; }; 45 | B2CBDA701348D520009DDE4D /* ASIProgressDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA181348D520009DDE4D /* ASIProgressDelegate.h */; }; 46 | B2CBDAAB1348D520009DDE4D /* Reachability.h in Headers */ = {isa = PBXBuildFile; fileRef = B2CBDA5B1348D520009DDE4D /* Reachability.h */; }; 47 | B2CBDAAC1348D520009DDE4D /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CBDA5C1348D520009DDE4D /* Reachability.m */; }; 48 | B2E034CD121DC80C00D02434 /* NSDictionary+oaCompareKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E03268121DC80B00D02434 /* NSDictionary+oaCompareKeys.h */; }; 49 | B2E034CE121DC80C00D02434 /* NSDictionary+oaCompareKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E03269121DC80B00D02434 /* NSDictionary+oaCompareKeys.m */; }; 50 | B2E034CF121DC80C00D02434 /* NSURL+OAuthString.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0326A121DC80B00D02434 /* NSURL+OAuthString.h */; }; 51 | B2E034D0121DC80C00D02434 /* NSURL+OAuthString.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E0326B121DC80B00D02434 /* NSURL+OAuthString.m */; }; 52 | B2E034D1121DC80C00D02434 /* SSOAConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0326C121DC80B00D02434 /* SSOAConsumer.h */; }; 53 | B2E034D2121DC80C00D02434 /* SSOAConsumer.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E0326D121DC80B00D02434 /* SSOAConsumer.m */; }; 54 | B2E034D3121DC80C00D02434 /* SSOAFormRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0326E121DC80B00D02434 /* SSOAFormRequest.h */; }; 55 | B2E034D4121DC80C00D02434 /* SSOAFormRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E0326F121DC80B00D02434 /* SSOAFormRequest.m */; }; 56 | B2E034D5121DC80C00D02434 /* SSOARequest.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E03270121DC80B00D02434 /* SSOARequest.h */; }; 57 | B2E034D6121DC80C00D02434 /* SSOARequest.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E03271121DC80B00D02434 /* SSOARequest.m */; }; 58 | B2E034D7121DC80C00D02434 /* SSOAToken.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E03272121DC80B00D02434 /* SSOAToken.h */; }; 59 | B2E034D8121DC80C00D02434 /* SSOAToken.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E03273121DC80B00D02434 /* SSOAToken.m */; }; 60 | B2E034D9121DC80C00D02434 /* SSOAuthKit.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E03274121DC80B00D02434 /* SSOAuthKit.h */; }; 61 | B2E034DA121DC80C00D02434 /* SSOAuthKitConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E03275121DC80B00D02434 /* SSOAuthKitConfiguration.h */; }; 62 | B2E034DB121DC80C00D02434 /* SSOAuthKitConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E03276121DC80B00D02434 /* SSOAuthKitConfiguration.m */; }; 63 | B2E034DE121DC80C00D02434 /* SSTwitterOAuthViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E03279121DC80B00D02434 /* SSTwitterOAuthViewController.h */; }; 64 | B2E034DF121DC80C00D02434 /* SSTwitterOAuthViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E0327A121DC80B00D02434 /* SSTwitterOAuthViewController.m */; }; 65 | B2E03540121DC80C00D02434 /* Base64Transcoder.c in Sources */ = {isa = PBXBuildFile; fileRef = B2E0332B121DC80B00D02434 /* Base64Transcoder.c */; }; 66 | B2E03541121DC80C00D02434 /* Base64Transcoder.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0332C121DC80B00D02434 /* Base64Transcoder.h */; }; 67 | B2E03542121DC80C00D02434 /* OAHMAC_SHA1SignatureProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0332D121DC80B00D02434 /* OAHMAC_SHA1SignatureProvider.h */; }; 68 | B2E03543121DC80C00D02434 /* OAHMAC_SHA1SignatureProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = B2E0332E121DC80B00D02434 /* OAHMAC_SHA1SignatureProvider.m */; }; 69 | B2E03544121DC80C00D02434 /* OASignatureProviding.h in Headers */ = {isa = PBXBuildFile; fileRef = B2E0332F121DC80B00D02434 /* OASignatureProviding.h */; }; 70 | B2E03636121DC81E00D02434 /* SSOAuthKit_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = B2E03635121DC81E00D02434 /* SSOAuthKit_Prefix.pch */; }; 71 | B2E03656121DC85D00D02434 /* libSSToolkit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E0363B121DC83C00D02434 /* libSSToolkit.a */; }; 72 | /* End PBXBuildFile section */ 73 | 74 | /* Begin PBXContainerItemProxy section */ 75 | B21B53EB13B7E36B00AF8B2A /* PBXContainerItemProxy */ = { 76 | isa = PBXContainerItemProxy; 77 | containerPortal = B2E033BA121DC80C00D02434 /* SSToolkit.xcodeproj */; 78 | proxyType = 2; 79 | remoteGlobalIDString = B239101D1357DC3E00ADE21B; 80 | remoteInfo = SSToolkitTests; 81 | }; 82 | B2E0363A121DC83C00D02434 /* PBXContainerItemProxy */ = { 83 | isa = PBXContainerItemProxy; 84 | containerPortal = B2E033BA121DC80C00D02434 /* SSToolkit.xcodeproj */; 85 | proxyType = 2; 86 | remoteGlobalIDString = D2AAC07E0554694100DB518D; 87 | remoteInfo = SSToolkit; 88 | }; 89 | B2E0365A121DC86900D02434 /* PBXContainerItemProxy */ = { 90 | isa = PBXContainerItemProxy; 91 | containerPortal = B2E033BA121DC80C00D02434 /* SSToolkit.xcodeproj */; 92 | proxyType = 1; 93 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 94 | remoteInfo = SSToolkit; 95 | }; 96 | /* End PBXContainerItemProxy section */ 97 | 98 | /* Begin PBXFileReference section */ 99 | B202D4621348D35A00C389A8 /* JSONKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSONKit.h; sourceTree = ""; }; 100 | B202D4631348D35A00C389A8 /* JSONKit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JSONKit.m; sourceTree = ""; }; 101 | B24ED8C4138C790F00FACB48 /* SSTwitterXAuthViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTwitterXAuthViewController.h; sourceTree = ""; }; 102 | B24ED8C5138C790F00FACB48 /* SSTwitterXAuthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSTwitterXAuthViewController.m; sourceTree = ""; }; 103 | B24ED8CD138C79CF00FACB48 /* SSTwitterAuthViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTwitterAuthViewControllerDelegate.h; sourceTree = ""; }; 104 | B24ED8D8138C7A9B00FACB48 /* SSTwitterAuthViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTwitterAuthViewController.h; sourceTree = ""; }; 105 | B24ED8D9138C7A9B00FACB48 /* SSTwitterAuthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSTwitterAuthViewController.m; sourceTree = ""; }; 106 | B27E1B2511F0D5E000165C54 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 107 | B27E1B2711F0D5E000165C54 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 108 | B27E1B2911F0D5E000165C54 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 109 | B27E1B2B11F0D5E000165C54 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 110 | B27E1B2D11F0D5E000165C54 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 111 | B27E1B2F11F0D5E000165C54 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 112 | B27E1B3111F0D5E000165C54 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 113 | B27E1B3311F0D5E000165C54 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 114 | B29851E511F0D865008B1A4A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 115 | B2CBDA051348D520009DDE4D /* ASIAuthenticationDialog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIAuthenticationDialog.h; sourceTree = ""; }; 116 | B2CBDA061348D520009DDE4D /* ASIAuthenticationDialog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIAuthenticationDialog.m; sourceTree = ""; }; 117 | B2CBDA071348D520009DDE4D /* ASICacheDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASICacheDelegate.h; sourceTree = ""; }; 118 | B2CBDA081348D520009DDE4D /* ASIDataCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDataCompressor.h; sourceTree = ""; }; 119 | B2CBDA091348D520009DDE4D /* ASIDataCompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDataCompressor.m; sourceTree = ""; }; 120 | B2CBDA0A1348D520009DDE4D /* ASIDataDecompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDataDecompressor.h; sourceTree = ""; }; 121 | B2CBDA0B1348D520009DDE4D /* ASIDataDecompressor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDataDecompressor.m; sourceTree = ""; }; 122 | B2CBDA0C1348D520009DDE4D /* ASIDownloadCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIDownloadCache.h; sourceTree = ""; }; 123 | B2CBDA0D1348D520009DDE4D /* ASIDownloadCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIDownloadCache.m; sourceTree = ""; }; 124 | B2CBDA0E1348D520009DDE4D /* ASIFormDataRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIFormDataRequest.h; sourceTree = ""; }; 125 | B2CBDA0F1348D520009DDE4D /* ASIFormDataRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIFormDataRequest.m; sourceTree = ""; }; 126 | B2CBDA101348D520009DDE4D /* ASIHTTPRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequest.h; sourceTree = ""; }; 127 | B2CBDA111348D520009DDE4D /* ASIHTTPRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIHTTPRequest.m; sourceTree = ""; }; 128 | B2CBDA121348D520009DDE4D /* ASIHTTPRequestConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequestConfig.h; sourceTree = ""; }; 129 | B2CBDA131348D520009DDE4D /* ASIHTTPRequestDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIHTTPRequestDelegate.h; sourceTree = ""; }; 130 | B2CBDA141348D520009DDE4D /* ASIInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIInputStream.h; sourceTree = ""; }; 131 | B2CBDA151348D520009DDE4D /* ASIInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASIInputStream.m; sourceTree = ""; }; 132 | B2CBDA161348D520009DDE4D /* ASINetworkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASINetworkQueue.h; sourceTree = ""; }; 133 | B2CBDA171348D520009DDE4D /* ASINetworkQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ASINetworkQueue.m; sourceTree = ""; }; 134 | B2CBDA181348D520009DDE4D /* ASIProgressDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ASIProgressDelegate.h; sourceTree = ""; }; 135 | B2CBDA5B1348D520009DDE4D /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Reachability.h; sourceTree = ""; }; 136 | B2CBDA5C1348D520009DDE4D /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Reachability.m; sourceTree = ""; }; 137 | B2E03268121DC80B00D02434 /* NSDictionary+oaCompareKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+oaCompareKeys.h"; sourceTree = ""; }; 138 | B2E03269121DC80B00D02434 /* NSDictionary+oaCompareKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+oaCompareKeys.m"; sourceTree = ""; }; 139 | B2E0326A121DC80B00D02434 /* NSURL+OAuthString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+OAuthString.h"; sourceTree = ""; }; 140 | B2E0326B121DC80B00D02434 /* NSURL+OAuthString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+OAuthString.m"; sourceTree = ""; }; 141 | B2E0326C121DC80B00D02434 /* SSOAConsumer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOAConsumer.h; sourceTree = ""; }; 142 | B2E0326D121DC80B00D02434 /* SSOAConsumer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSOAConsumer.m; sourceTree = ""; }; 143 | B2E0326E121DC80B00D02434 /* SSOAFormRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOAFormRequest.h; sourceTree = ""; }; 144 | B2E0326F121DC80B00D02434 /* SSOAFormRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSOAFormRequest.m; sourceTree = ""; }; 145 | B2E03270121DC80B00D02434 /* SSOARequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOARequest.h; sourceTree = ""; }; 146 | B2E03271121DC80B00D02434 /* SSOARequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSOARequest.m; sourceTree = ""; }; 147 | B2E03272121DC80B00D02434 /* SSOAToken.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOAToken.h; sourceTree = ""; }; 148 | B2E03273121DC80B00D02434 /* SSOAToken.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSOAToken.m; sourceTree = ""; }; 149 | B2E03274121DC80B00D02434 /* SSOAuthKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOAuthKit.h; sourceTree = ""; }; 150 | B2E03275121DC80B00D02434 /* SSOAuthKitConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOAuthKitConfiguration.h; sourceTree = ""; }; 151 | B2E03276121DC80B00D02434 /* SSOAuthKitConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSOAuthKitConfiguration.m; sourceTree = ""; }; 152 | B2E03279121DC80B00D02434 /* SSTwitterOAuthViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSTwitterOAuthViewController.h; sourceTree = ""; }; 153 | B2E0327A121DC80B00D02434 /* SSTwitterOAuthViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSTwitterOAuthViewController.m; sourceTree = ""; }; 154 | B2E0332B121DC80B00D02434 /* Base64Transcoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = Base64Transcoder.c; sourceTree = ""; }; 155 | B2E0332C121DC80B00D02434 /* Base64Transcoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Base64Transcoder.h; sourceTree = ""; }; 156 | B2E0332D121DC80B00D02434 /* OAHMAC_SHA1SignatureProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OAHMAC_SHA1SignatureProvider.h; sourceTree = ""; }; 157 | B2E0332E121DC80B00D02434 /* OAHMAC_SHA1SignatureProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OAHMAC_SHA1SignatureProvider.m; sourceTree = ""; }; 158 | B2E0332F121DC80B00D02434 /* OASignatureProviding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OASignatureProviding.h; sourceTree = ""; }; 159 | B2E033BA121DC80C00D02434 /* SSToolkit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SSToolkit.xcodeproj; path = SSToolkit/SSToolkit.xcodeproj; sourceTree = ""; }; 160 | B2E03632121DC81100D02434 /* SSOAuthKit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = SSOAuthKit.bundle; sourceTree = ""; }; 161 | B2E03635121DC81E00D02434 /* SSOAuthKit_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSOAuthKit_Prefix.pch; sourceTree = ""; }; 162 | D2AAC07E0554694100DB518D /* libSSOAuthKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSSOAuthKit.a; sourceTree = BUILT_PRODUCTS_DIR; }; 163 | /* End PBXFileReference section */ 164 | 165 | /* Begin PBXFrameworksBuildPhase section */ 166 | D2AAC07C0554694100DB518D /* Frameworks */ = { 167 | isa = PBXFrameworksBuildPhase; 168 | buildActionMask = 2147483647; 169 | files = ( 170 | B27E1B2611F0D5E000165C54 /* CFNetwork.framework in Frameworks */, 171 | B27E1B2811F0D5E000165C54 /* CoreGraphics.framework in Frameworks */, 172 | B27E1B2A11F0D5E000165C54 /* Foundation.framework in Frameworks */, 173 | B27E1B2C11F0D5E000165C54 /* MobileCoreServices.framework in Frameworks */, 174 | B27E1B2E11F0D5E000165C54 /* QuartzCore.framework in Frameworks */, 175 | B27E1B3011F0D5E000165C54 /* SystemConfiguration.framework in Frameworks */, 176 | B27E1B3211F0D5E000165C54 /* UIKit.framework in Frameworks */, 177 | B27E1B3411F0D5E000165C54 /* libz.dylib in Frameworks */, 178 | B29851E611F0D865008B1A4A /* Security.framework in Frameworks */, 179 | B2E03656121DC85D00D02434 /* libSSToolkit.a in Frameworks */, 180 | ); 181 | runOnlyForDeploymentPostprocessing = 0; 182 | }; 183 | /* End PBXFrameworksBuildPhase section */ 184 | 185 | /* Begin PBXGroup section */ 186 | 034768DFFF38A50411DB9C8B /* Products */ = { 187 | isa = PBXGroup; 188 | children = ( 189 | D2AAC07E0554694100DB518D /* libSSOAuthKit.a */, 190 | ); 191 | name = Products; 192 | sourceTree = ""; 193 | }; 194 | 0867D691FE84028FC02AAC07 /* TWOAuthKit */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | B2E03267121DC80B00D02434 /* SSOAuthKit */, 198 | B298527F11F0DCB4008B1A4A /* Resources */, 199 | B2BA993610B352D3001EEA88 /* Other Sources */, 200 | 0867D69AFE84028FC02AAC07 /* Frameworks */, 201 | 034768DFFF38A50411DB9C8B /* Products */, 202 | ); 203 | name = TWOAuthKit; 204 | sourceTree = ""; 205 | }; 206 | 0867D69AFE84028FC02AAC07 /* Frameworks */ = { 207 | isa = PBXGroup; 208 | children = ( 209 | B27E1B2511F0D5E000165C54 /* CFNetwork.framework */, 210 | B27E1B2711F0D5E000165C54 /* CoreGraphics.framework */, 211 | B27E1B2911F0D5E000165C54 /* Foundation.framework */, 212 | B27E1B2B11F0D5E000165C54 /* MobileCoreServices.framework */, 213 | B27E1B2D11F0D5E000165C54 /* QuartzCore.framework */, 214 | B27E1B2F11F0D5E000165C54 /* SystemConfiguration.framework */, 215 | B27E1B3111F0D5E000165C54 /* UIKit.framework */, 216 | B27E1B3311F0D5E000165C54 /* libz.dylib */, 217 | B29851E511F0D865008B1A4A /* Security.framework */, 218 | ); 219 | name = Frameworks; 220 | sourceTree = ""; 221 | }; 222 | B202D43C1348D35A00C389A8 /* JSONKit */ = { 223 | isa = PBXGroup; 224 | children = ( 225 | B202D4621348D35A00C389A8 /* JSONKit.h */, 226 | B202D4631348D35A00C389A8 /* JSONKit.m */, 227 | ); 228 | path = JSONKit; 229 | sourceTree = ""; 230 | }; 231 | B24ED8DD138C7ACC00FACB48 /* Categories */ = { 232 | isa = PBXGroup; 233 | children = ( 234 | B2E03268121DC80B00D02434 /* NSDictionary+oaCompareKeys.h */, 235 | B2E03269121DC80B00D02434 /* NSDictionary+oaCompareKeys.m */, 236 | B2E0326A121DC80B00D02434 /* NSURL+OAuthString.h */, 237 | B2E0326B121DC80B00D02434 /* NSURL+OAuthString.m */, 238 | ); 239 | name = Categories; 240 | sourceTree = ""; 241 | }; 242 | B24ED8DE138C7AD500FACB48 /* OAuth */ = { 243 | isa = PBXGroup; 244 | children = ( 245 | B2E0326C121DC80B00D02434 /* SSOAConsumer.h */, 246 | B2E0326D121DC80B00D02434 /* SSOAConsumer.m */, 247 | B2E0326E121DC80B00D02434 /* SSOAFormRequest.h */, 248 | B2E0326F121DC80B00D02434 /* SSOAFormRequest.m */, 249 | B2E03270121DC80B00D02434 /* SSOARequest.h */, 250 | B2E03271121DC80B00D02434 /* SSOARequest.m */, 251 | B2E03272121DC80B00D02434 /* SSOAToken.h */, 252 | B2E03273121DC80B00D02434 /* SSOAToken.m */, 253 | ); 254 | name = OAuth; 255 | sourceTree = ""; 256 | }; 257 | B24ED8DF138C7AE300FACB48 /* Twitter */ = { 258 | isa = PBXGroup; 259 | children = ( 260 | B24ED8D8138C7A9B00FACB48 /* SSTwitterAuthViewController.h */, 261 | B24ED8D9138C7A9B00FACB48 /* SSTwitterAuthViewController.m */, 262 | B24ED8CD138C79CF00FACB48 /* SSTwitterAuthViewControllerDelegate.h */, 263 | B2E03279121DC80B00D02434 /* SSTwitterOAuthViewController.h */, 264 | B2E0327A121DC80B00D02434 /* SSTwitterOAuthViewController.m */, 265 | B24ED8C4138C790F00FACB48 /* SSTwitterXAuthViewController.h */, 266 | B24ED8C5138C790F00FACB48 /* SSTwitterXAuthViewController.m */, 267 | ); 268 | name = Twitter; 269 | sourceTree = ""; 270 | }; 271 | B24ED8E0138C7AED00FACB48 /* Configuration */ = { 272 | isa = PBXGroup; 273 | children = ( 274 | B2E03275121DC80B00D02434 /* SSOAuthKitConfiguration.h */, 275 | B2E03276121DC80B00D02434 /* SSOAuthKitConfiguration.m */, 276 | ); 277 | name = Configuration; 278 | sourceTree = ""; 279 | }; 280 | B298527F11F0DCB4008B1A4A /* Resources */ = { 281 | isa = PBXGroup; 282 | children = ( 283 | B2E03632121DC81100D02434 /* SSOAuthKit.bundle */, 284 | ); 285 | path = Resources; 286 | sourceTree = ""; 287 | }; 288 | B2BA993610B352D3001EEA88 /* Other Sources */ = { 289 | isa = PBXGroup; 290 | children = ( 291 | B2E03635121DC81E00D02434 /* SSOAuthKit_Prefix.pch */, 292 | ); 293 | path = "Other Sources"; 294 | sourceTree = ""; 295 | }; 296 | B2CBDA041348D520009DDE4D /* Classes */ = { 297 | isa = PBXGroup; 298 | children = ( 299 | B2CBDA051348D520009DDE4D /* ASIAuthenticationDialog.h */, 300 | B2CBDA061348D520009DDE4D /* ASIAuthenticationDialog.m */, 301 | B2CBDA071348D520009DDE4D /* ASICacheDelegate.h */, 302 | B2CBDA081348D520009DDE4D /* ASIDataCompressor.h */, 303 | B2CBDA091348D520009DDE4D /* ASIDataCompressor.m */, 304 | B2CBDA0A1348D520009DDE4D /* ASIDataDecompressor.h */, 305 | B2CBDA0B1348D520009DDE4D /* ASIDataDecompressor.m */, 306 | B2CBDA0C1348D520009DDE4D /* ASIDownloadCache.h */, 307 | B2CBDA0D1348D520009DDE4D /* ASIDownloadCache.m */, 308 | B2CBDA0E1348D520009DDE4D /* ASIFormDataRequest.h */, 309 | B2CBDA0F1348D520009DDE4D /* ASIFormDataRequest.m */, 310 | B2CBDA101348D520009DDE4D /* ASIHTTPRequest.h */, 311 | B2CBDA111348D520009DDE4D /* ASIHTTPRequest.m */, 312 | B2CBDA121348D520009DDE4D /* ASIHTTPRequestConfig.h */, 313 | B2CBDA131348D520009DDE4D /* ASIHTTPRequestDelegate.h */, 314 | B2CBDA141348D520009DDE4D /* ASIInputStream.h */, 315 | B2CBDA151348D520009DDE4D /* ASIInputStream.m */, 316 | B2CBDA161348D520009DDE4D /* ASINetworkQueue.h */, 317 | B2CBDA171348D520009DDE4D /* ASINetworkQueue.m */, 318 | B2CBDA181348D520009DDE4D /* ASIProgressDelegate.h */, 319 | ); 320 | path = Classes; 321 | sourceTree = ""; 322 | }; 323 | B2CBDA571348D520009DDE4D /* External */ = { 324 | isa = PBXGroup; 325 | children = ( 326 | B2CBDA5A1348D520009DDE4D /* Reachability */, 327 | ); 328 | path = External; 329 | sourceTree = ""; 330 | }; 331 | B2CBDA5A1348D520009DDE4D /* Reachability */ = { 332 | isa = PBXGroup; 333 | children = ( 334 | B2CBDA5B1348D520009DDE4D /* Reachability.h */, 335 | B2CBDA5C1348D520009DDE4D /* Reachability.m */, 336 | ); 337 | path = Reachability; 338 | sourceTree = ""; 339 | }; 340 | B2E03267121DC80B00D02434 /* SSOAuthKit */ = { 341 | isa = PBXGroup; 342 | children = ( 343 | B2E03274121DC80B00D02434 /* SSOAuthKit.h */, 344 | B24ED8E0138C7AED00FACB48 /* Configuration */, 345 | B24ED8DE138C7AD500FACB48 /* OAuth */, 346 | B24ED8DF138C7AE300FACB48 /* Twitter */, 347 | B24ED8DD138C7ACC00FACB48 /* Categories */, 348 | B2E0327B121DC80B00D02434 /* Vendor */, 349 | ); 350 | path = SSOAuthKit; 351 | sourceTree = ""; 352 | }; 353 | B2E0327B121DC80B00D02434 /* Vendor */ = { 354 | isa = PBXGroup; 355 | children = ( 356 | B2E033BA121DC80C00D02434 /* SSToolkit.xcodeproj */, 357 | B2E0327C121DC80B00D02434 /* ASIHTTPRequest */, 358 | B202D43C1348D35A00C389A8 /* JSONKit */, 359 | B2E0332A121DC80B00D02434 /* OAuthConsumer */, 360 | ); 361 | path = Vendor; 362 | sourceTree = ""; 363 | }; 364 | B2E0327C121DC80B00D02434 /* ASIHTTPRequest */ = { 365 | isa = PBXGroup; 366 | children = ( 367 | B2CBDA041348D520009DDE4D /* Classes */, 368 | B2CBDA571348D520009DDE4D /* External */, 369 | ); 370 | path = ASIHTTPRequest; 371 | sourceTree = ""; 372 | }; 373 | B2E0332A121DC80B00D02434 /* OAuthConsumer */ = { 374 | isa = PBXGroup; 375 | children = ( 376 | B2E0332B121DC80B00D02434 /* Base64Transcoder.c */, 377 | B2E0332C121DC80B00D02434 /* Base64Transcoder.h */, 378 | B2E0332D121DC80B00D02434 /* OAHMAC_SHA1SignatureProvider.h */, 379 | B2E0332E121DC80B00D02434 /* OAHMAC_SHA1SignatureProvider.m */, 380 | B2E0332F121DC80B00D02434 /* OASignatureProviding.h */, 381 | ); 382 | path = OAuthConsumer; 383 | sourceTree = ""; 384 | }; 385 | B2E03637121DC83C00D02434 /* Products */ = { 386 | isa = PBXGroup; 387 | children = ( 388 | B2E0363B121DC83C00D02434 /* libSSToolkit.a */, 389 | B21B53EC13B7E36B00AF8B2A /* SSToolkitTests.app */, 390 | ); 391 | name = Products; 392 | sourceTree = ""; 393 | }; 394 | /* End PBXGroup section */ 395 | 396 | /* Begin PBXHeadersBuildPhase section */ 397 | D2AAC07A0554694100DB518D /* Headers */ = { 398 | isa = PBXHeadersBuildPhase; 399 | buildActionMask = 2147483647; 400 | files = ( 401 | B2E034CD121DC80C00D02434 /* NSDictionary+oaCompareKeys.h in Headers */, 402 | B2E034CF121DC80C00D02434 /* NSURL+OAuthString.h in Headers */, 403 | B2E034D1121DC80C00D02434 /* SSOAConsumer.h in Headers */, 404 | B2E034D3121DC80C00D02434 /* SSOAFormRequest.h in Headers */, 405 | B2E034D5121DC80C00D02434 /* SSOARequest.h in Headers */, 406 | B2E034D7121DC80C00D02434 /* SSOAToken.h in Headers */, 407 | B2E034D9121DC80C00D02434 /* SSOAuthKit.h in Headers */, 408 | B2E034DA121DC80C00D02434 /* SSOAuthKitConfiguration.h in Headers */, 409 | B2E034DE121DC80C00D02434 /* SSTwitterOAuthViewController.h in Headers */, 410 | B2E03541121DC80C00D02434 /* Base64Transcoder.h in Headers */, 411 | B2E03542121DC80C00D02434 /* OAHMAC_SHA1SignatureProvider.h in Headers */, 412 | B2E03544121DC80C00D02434 /* OASignatureProviding.h in Headers */, 413 | B2E03636121DC81E00D02434 /* SSOAuthKit_Prefix.pch in Headers */, 414 | B202D4651348D35A00C389A8 /* JSONKit.h in Headers */, 415 | B2CBDA5D1348D520009DDE4D /* ASIAuthenticationDialog.h in Headers */, 416 | B2CBDA5F1348D520009DDE4D /* ASICacheDelegate.h in Headers */, 417 | B2CBDA601348D520009DDE4D /* ASIDataCompressor.h in Headers */, 418 | B2CBDA621348D520009DDE4D /* ASIDataDecompressor.h in Headers */, 419 | B2CBDA641348D520009DDE4D /* ASIDownloadCache.h in Headers */, 420 | B2CBDA661348D520009DDE4D /* ASIFormDataRequest.h in Headers */, 421 | B2CBDA681348D520009DDE4D /* ASIHTTPRequest.h in Headers */, 422 | B2CBDA6A1348D520009DDE4D /* ASIHTTPRequestConfig.h in Headers */, 423 | B2CBDA6B1348D520009DDE4D /* ASIHTTPRequestDelegate.h in Headers */, 424 | B2CBDA6C1348D520009DDE4D /* ASIInputStream.h in Headers */, 425 | B2CBDA6E1348D520009DDE4D /* ASINetworkQueue.h in Headers */, 426 | B2CBDA701348D520009DDE4D /* ASIProgressDelegate.h in Headers */, 427 | B2CBDAAB1348D520009DDE4D /* Reachability.h in Headers */, 428 | B24ED8C6138C790F00FACB48 /* SSTwitterXAuthViewController.h in Headers */, 429 | B24ED8CE138C79CF00FACB48 /* SSTwitterAuthViewControllerDelegate.h in Headers */, 430 | B24ED8DA138C7A9B00FACB48 /* SSTwitterAuthViewController.h in Headers */, 431 | ); 432 | runOnlyForDeploymentPostprocessing = 0; 433 | }; 434 | /* End PBXHeadersBuildPhase section */ 435 | 436 | /* Begin PBXNativeTarget section */ 437 | D2AAC07D0554694100DB518D /* SSOAuthKit */ = { 438 | isa = PBXNativeTarget; 439 | buildConfigurationList = 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "SSOAuthKit" */; 440 | buildPhases = ( 441 | D2AAC07A0554694100DB518D /* Headers */, 442 | D2AAC07B0554694100DB518D /* Sources */, 443 | D2AAC07C0554694100DB518D /* Frameworks */, 444 | ); 445 | buildRules = ( 446 | ); 447 | dependencies = ( 448 | B2E0365B121DC86900D02434 /* PBXTargetDependency */, 449 | ); 450 | name = SSOAuthKit; 451 | productName = TWOAuthKit; 452 | productReference = D2AAC07E0554694100DB518D /* libSSOAuthKit.a */; 453 | productType = "com.apple.product-type.library.static"; 454 | }; 455 | /* End PBXNativeTarget section */ 456 | 457 | /* Begin PBXProject section */ 458 | 0867D690FE84028FC02AAC07 /* Project object */ = { 459 | isa = PBXProject; 460 | attributes = { 461 | LastUpgradeCheck = 0420; 462 | ORGANIZATIONNAME = "Sam Soffes"; 463 | }; 464 | buildConfigurationList = 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "SSOAuthKit" */; 465 | compatibilityVersion = "Xcode 3.2"; 466 | developmentRegion = English; 467 | hasScannedForEncodings = 1; 468 | knownRegions = ( 469 | English, 470 | Japanese, 471 | French, 472 | German, 473 | ); 474 | mainGroup = 0867D691FE84028FC02AAC07 /* TWOAuthKit */; 475 | productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 476 | projectDirPath = ""; 477 | projectReferences = ( 478 | { 479 | ProductGroup = B2E03637121DC83C00D02434 /* Products */; 480 | ProjectRef = B2E033BA121DC80C00D02434 /* SSToolkit.xcodeproj */; 481 | }, 482 | ); 483 | projectRoot = ""; 484 | targets = ( 485 | D2AAC07D0554694100DB518D /* SSOAuthKit */, 486 | ); 487 | }; 488 | /* End PBXProject section */ 489 | 490 | /* Begin PBXReferenceProxy section */ 491 | B21B53EC13B7E36B00AF8B2A /* SSToolkitTests.app */ = { 492 | isa = PBXReferenceProxy; 493 | fileType = wrapper.application; 494 | path = SSToolkitTests.app; 495 | remoteRef = B21B53EB13B7E36B00AF8B2A /* PBXContainerItemProxy */; 496 | sourceTree = BUILT_PRODUCTS_DIR; 497 | }; 498 | B2E0363B121DC83C00D02434 /* libSSToolkit.a */ = { 499 | isa = PBXReferenceProxy; 500 | fileType = archive.ar; 501 | path = libSSToolkit.a; 502 | remoteRef = B2E0363A121DC83C00D02434 /* PBXContainerItemProxy */; 503 | sourceTree = BUILT_PRODUCTS_DIR; 504 | }; 505 | /* End PBXReferenceProxy section */ 506 | 507 | /* Begin PBXSourcesBuildPhase section */ 508 | D2AAC07B0554694100DB518D /* Sources */ = { 509 | isa = PBXSourcesBuildPhase; 510 | buildActionMask = 2147483647; 511 | files = ( 512 | B2E034CE121DC80C00D02434 /* NSDictionary+oaCompareKeys.m in Sources */, 513 | B2E034D0121DC80C00D02434 /* NSURL+OAuthString.m in Sources */, 514 | B2E034D2121DC80C00D02434 /* SSOAConsumer.m in Sources */, 515 | B2E034D4121DC80C00D02434 /* SSOAFormRequest.m in Sources */, 516 | B2E034D6121DC80C00D02434 /* SSOARequest.m in Sources */, 517 | B2E034D8121DC80C00D02434 /* SSOAToken.m in Sources */, 518 | B2E034DB121DC80C00D02434 /* SSOAuthKitConfiguration.m in Sources */, 519 | B2E034DF121DC80C00D02434 /* SSTwitterOAuthViewController.m in Sources */, 520 | B2E03540121DC80C00D02434 /* Base64Transcoder.c in Sources */, 521 | B2E03543121DC80C00D02434 /* OAHMAC_SHA1SignatureProvider.m in Sources */, 522 | B202D4661348D35A00C389A8 /* JSONKit.m in Sources */, 523 | B2CBDA5E1348D520009DDE4D /* ASIAuthenticationDialog.m in Sources */, 524 | B2CBDA611348D520009DDE4D /* ASIDataCompressor.m in Sources */, 525 | B2CBDA631348D520009DDE4D /* ASIDataDecompressor.m in Sources */, 526 | B2CBDA651348D520009DDE4D /* ASIDownloadCache.m in Sources */, 527 | B2CBDA671348D520009DDE4D /* ASIFormDataRequest.m in Sources */, 528 | B2CBDA691348D520009DDE4D /* ASIHTTPRequest.m in Sources */, 529 | B2CBDA6D1348D520009DDE4D /* ASIInputStream.m in Sources */, 530 | B2CBDA6F1348D520009DDE4D /* ASINetworkQueue.m in Sources */, 531 | B2CBDAAC1348D520009DDE4D /* Reachability.m in Sources */, 532 | B24ED8C7138C790F00FACB48 /* SSTwitterXAuthViewController.m in Sources */, 533 | B24ED8DB138C7A9B00FACB48 /* SSTwitterAuthViewController.m in Sources */, 534 | ); 535 | runOnlyForDeploymentPostprocessing = 0; 536 | }; 537 | /* End PBXSourcesBuildPhase section */ 538 | 539 | /* Begin PBXTargetDependency section */ 540 | B2E0365B121DC86900D02434 /* PBXTargetDependency */ = { 541 | isa = PBXTargetDependency; 542 | name = SSToolkit; 543 | targetProxy = B2E0365A121DC86900D02434 /* PBXContainerItemProxy */; 544 | }; 545 | /* End PBXTargetDependency section */ 546 | 547 | /* Begin XCBuildConfiguration section */ 548 | 1DEB921F08733DC00010E9CD /* Debug */ = { 549 | isa = XCBuildConfiguration; 550 | buildSettings = { 551 | ALWAYS_SEARCH_USER_PATHS = NO; 552 | ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; 553 | COPY_PHASE_STRIP = NO; 554 | DSTROOT = /tmp/SSOAuthKit.dst; 555 | FRAMEWORK_SEARCH_PATHS = ( 556 | "$(inherited)", 557 | "\"$(SRCROOT)/SSOAuthKit/Vendor/yajl-objc/Project/Frameworks\"", 558 | ); 559 | GCC_DYNAMIC_NO_PIC = NO; 560 | GCC_MODEL_TUNING = G5; 561 | GCC_OPTIMIZATION_LEVEL = 0; 562 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 563 | GCC_PREFIX_HEADER = "Other Sources/SSOAuthKit_Prefix.pch"; 564 | HEADER_SEARCH_PATHS = ( 565 | "\"$(SRCROOT)/SSOAuthKit/Vendor/yajl-objc\"/**", 566 | "\"$(SRCROOT)/SSOAuthKit/Vendor/SSToolkit\"", 567 | ); 568 | INSTALL_PATH = /usr/local/lib; 569 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 570 | LIBRARY_SEARCH_PATHS = ( 571 | "$(inherited)", 572 | "\"$(SRCROOT)/SSOAuthKit/Vendor/yajl-objc/Project-IPhone/Libraries/GHUnit\"", 573 | ); 574 | PRODUCT_NAME = SSOAuthKit; 575 | SDKROOT = iphoneos; 576 | }; 577 | name = Debug; 578 | }; 579 | 1DEB922008733DC00010E9CD /* Release */ = { 580 | isa = XCBuildConfiguration; 581 | buildSettings = { 582 | ALWAYS_SEARCH_USER_PATHS = NO; 583 | ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; 584 | DSTROOT = /tmp/SSOAuthKit.dst; 585 | FRAMEWORK_SEARCH_PATHS = ( 586 | "$(inherited)", 587 | "\"$(SRCROOT)/SSOAuthKit/Vendor/yajl-objc/Project/Frameworks\"", 588 | ); 589 | GCC_MODEL_TUNING = G5; 590 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 591 | GCC_PREFIX_HEADER = "Other Sources/SSOAuthKit_Prefix.pch"; 592 | HEADER_SEARCH_PATHS = ( 593 | "\"$(SRCROOT)/SSOAuthKit/Vendor/yajl-objc\"/**", 594 | "\"$(SRCROOT)/SSOAuthKit/Vendor/SSToolkit\"", 595 | ); 596 | INSTALL_PATH = /usr/local/lib; 597 | IPHONEOS_DEPLOYMENT_TARGET = 4.0; 598 | LIBRARY_SEARCH_PATHS = ( 599 | "$(inherited)", 600 | "\"$(SRCROOT)/SSOAuthKit/Vendor/yajl-objc/Project-IPhone/Libraries/GHUnit\"", 601 | ); 602 | PRODUCT_NAME = SSOAuthKit; 603 | SDKROOT = iphoneos; 604 | }; 605 | name = Release; 606 | }; 607 | 1DEB922308733DC00010E9CD /* Debug */ = { 608 | isa = XCBuildConfiguration; 609 | buildSettings = { 610 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 611 | GCC_C_LANGUAGE_STANDARD = c99; 612 | GCC_OPTIMIZATION_LEVEL = 0; 613 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 614 | GCC_WARN_UNUSED_VARIABLE = YES; 615 | OTHER_LDFLAGS = "-ObjC"; 616 | SDKROOT = iphoneos; 617 | }; 618 | name = Debug; 619 | }; 620 | 1DEB922408733DC00010E9CD /* Release */ = { 621 | isa = XCBuildConfiguration; 622 | buildSettings = { 623 | ARCHS = "$(ARCHS_STANDARD_32_BIT)"; 624 | GCC_C_LANGUAGE_STANDARD = c99; 625 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 626 | GCC_WARN_UNUSED_VARIABLE = YES; 627 | OTHER_LDFLAGS = "-ObjC"; 628 | SDKROOT = iphoneos; 629 | }; 630 | name = Release; 631 | }; 632 | /* End XCBuildConfiguration section */ 633 | 634 | /* Begin XCConfigurationList section */ 635 | 1DEB921E08733DC00010E9CD /* Build configuration list for PBXNativeTarget "SSOAuthKit" */ = { 636 | isa = XCConfigurationList; 637 | buildConfigurations = ( 638 | 1DEB921F08733DC00010E9CD /* Debug */, 639 | 1DEB922008733DC00010E9CD /* Release */, 640 | ); 641 | defaultConfigurationIsVisible = 0; 642 | defaultConfigurationName = Release; 643 | }; 644 | 1DEB922208733DC00010E9CD /* Build configuration list for PBXProject "SSOAuthKit" */ = { 645 | isa = XCConfigurationList; 646 | buildConfigurations = ( 647 | 1DEB922308733DC00010E9CD /* Debug */, 648 | 1DEB922408733DC00010E9CD /* Release */, 649 | ); 650 | defaultConfigurationIsVisible = 0; 651 | defaultConfigurationName = Release; 652 | }; 653 | /* End XCConfigurationList section */ 654 | }; 655 | rootObject = 0867D690FE84028FC02AAC07 /* Project object */; 656 | } 657 | -------------------------------------------------------------------------------- /SSOAuthKit/NSDictionary+oaCompareKeys.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+oaCompareKeys.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | @interface NSDictionary (oaCompareKeys) 10 | 11 | - (NSComparisonResult)oaCompareKeys:(NSDictionary *)other; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SSOAuthKit/NSDictionary+oaCompareKeys.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSDictionary+oaCompareKeys.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "NSDictionary+oaCompareKeys.h" 10 | 11 | @implementation NSDictionary (oaCompareKeys) 12 | 13 | - (NSComparisonResult)oaCompareKeys:(NSDictionary *)other { 14 | return [[self objectForKey:@"key"] compare:[other objectForKey:@"key"]]; 15 | } 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /SSOAuthKit/NSURL+OAuthString.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+OAuthString.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 11/17/09. 6 | // Copyright 2009-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | @interface NSURL (OAuthString) 10 | 11 | - (NSString *)OAuthString; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /SSOAuthKit/NSURL+OAuthString.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSURL+OAuthString.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 11/17/09. 6 | // Copyright 2009-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "NSURL+OAuthString.h" 10 | 11 | @implementation NSURL (OAuthString) 12 | 13 | // OAuth Spec 9.1.2 "Construct Request URL" 14 | // @see http://oauth.net/core/1.0#rfc.section.9.1.2 15 | - (NSString *)OAuthString { 16 | NSString *lowercaseScheme = [[self scheme] lowercaseString]; 17 | 18 | // Check port - only show port if nonstandard 19 | NSString *port = @""; 20 | if ([self port]) { 21 | NSInteger portInteger = [[self port] integerValue]; 22 | if (!(([lowercaseScheme isEqualToString:@"http"] && portInteger == 80) || 23 | ([lowercaseScheme isEqualToString:@"https"] && portInteger == 443) 24 | )) { 25 | port = [NSString stringWithFormat:@":%i", portInteger]; 26 | } 27 | } 28 | 29 | // Build string 30 | return [[NSString stringWithFormat:@"%@://%@%@%@", lowercaseScheme, [self host], port, [self path]] lowercaseString]; 31 | } 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAConsumer.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAConsumer.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | @interface SSOAConsumer : NSObject { 10 | 11 | @private 12 | 13 | NSString *_key; 14 | NSString *_secret; 15 | } 16 | 17 | @property (nonatomic, copy) NSString *key; 18 | @property (nonatomic, copy) NSString *secret; 19 | 20 | // Initializers 21 | - (id)initWithKey:(NSString *)aKey secret:(NSString *)aSecret; 22 | - (id)initWithHTTPResponseBody:(NSString *)body; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAConsumer.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAConsumer.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSOAConsumer.h" 10 | 11 | @implementation SSOAConsumer 12 | 13 | @synthesize key = _key; 14 | @synthesize secret = _secret; 15 | 16 | #pragma mark - 17 | #pragma mark NSObject 18 | 19 | - (void)dealloc { 20 | self.key = nil; 21 | self.secret = nil; 22 | [super dealloc]; 23 | } 24 | 25 | 26 | #pragma mark - 27 | #pragma mark Initializers 28 | 29 | - (id)initWithKey:(NSString *)aKey secret:(NSString *)aSecret { 30 | if (aKey == nil || aSecret == nil) { 31 | return nil; 32 | } 33 | 34 | if ((self = [super init])) { 35 | self.key = aKey; 36 | self.secret = aSecret; 37 | } 38 | return self; 39 | } 40 | 41 | 42 | - (id)initWithHTTPResponseBody:(NSString *)body { 43 | NSString *aKey = nil; 44 | NSString *aSecret = nil; 45 | 46 | NSArray *pairs = [body componentsSeparatedByString:@"&"]; 47 | 48 | for (NSString *pair in pairs) { 49 | NSArray *elements = [pair componentsSeparatedByString:@"="]; 50 | if ([[elements objectAtIndex:0] isEqualToString:@"oauth_token"]) { 51 | aKey = [elements objectAtIndex:1]; 52 | } else if ([[elements objectAtIndex:0] isEqualToString:@"oauth_token_secret"]) { 53 | aSecret = [elements objectAtIndex:1]; 54 | } 55 | } 56 | 57 | self = [self initWithKey:aKey secret:aSecret]; 58 | return self; 59 | } 60 | 61 | 62 | #pragma mark - 63 | #pragma mark NSCoding 64 | 65 | - (id)initWithCoder:(NSCoder *)decoder { 66 | if ((self = [super init])) { 67 | self.key = [decoder decodeObjectForKey:@"key"]; 68 | self.secret = [decoder decodeObjectForKey:@"secret"]; 69 | } 70 | return self; 71 | } 72 | 73 | 74 | - (void)encodeWithCoder:(NSCoder *)encoder { 75 | [encoder encodeObject:self.key forKey:@"key"]; 76 | [encoder encodeObject:self.secret forKey:@"secret"]; 77 | } 78 | 79 | 80 | #pragma mark - 81 | #pragma mark NSCopying 82 | 83 | - (id)copyWithZone:(NSZone *)zone { 84 | return [[[self class] alloc] initWithKey:self.key secret:self.secret]; 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAFormRequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAFormRequest.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 4/7/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "ASIFormDataRequest.h" 10 | 11 | @class SSOAToken; 12 | 13 | @interface SSOAFormRequest : ASIFormDataRequest { 14 | 15 | @private 16 | 17 | SSOAToken *_token; 18 | } 19 | 20 | @property (nonatomic, retain) SSOAToken *token; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAFormRequest.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAFormRequest.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 4/7/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSOAFormRequest.h" 10 | #import "SSOAToken.h" 11 | #import "SSOAuthKitConfiguration.h" 12 | #import "OAHMAC_SHA1SignatureProvider.h" 13 | #import "NSURL+OAuthString.h" 14 | #import "NSDictionary+oaCompareKeys.h" 15 | #import 16 | 17 | @implementation SSOAFormRequest 18 | 19 | @synthesize token = _token; 20 | 21 | #pragma mark - 22 | #pragma mark NSObject 23 | 24 | - (void)dealloc { 25 | self.token = nil; 26 | [super dealloc]; 27 | } 28 | 29 | 30 | #pragma mark - 31 | #pragma mark ASIHTTPRequest 32 | 33 | - (id)initWithURL:(NSURL *)newURL { 34 | if ((self = [super initWithURL:newURL])) { 35 | self.useCookiePersistence = NO; 36 | self.requestMethod = @"POST"; 37 | } 38 | return self; 39 | } 40 | 41 | 42 | - (void)buildRequestHeaders { 43 | [super buildRequestHeaders]; 44 | 45 | if ([SSOAuthKitConfiguration consumerKey] == nil || [SSOAuthKitConfiguration consumerSecret] == nil) { 46 | return; 47 | } 48 | 49 | // Signature provider 50 | id signatureProvider = [[OAHMAC_SHA1SignatureProvider alloc] init]; 51 | 52 | // Timestamp 53 | NSString *timestamp = [NSString stringWithFormat:@"%d", time(NULL)]; 54 | 55 | // Nonce 56 | CFUUIDRef theUUID = CFUUIDCreate(NULL); 57 | CFStringRef string = CFUUIDCreateString(NULL, theUUID); 58 | CFRelease(theUUID); 59 | NSString *nonce = [(NSString *)string autorelease]; 60 | 61 | // OAuth Spec, Section 9.1.1 "Normalize Request Parameters" 62 | // Build a sorted array of both request parameters and OAuth header parameters 63 | NSMutableArray *parameterPairs = [[NSMutableArray alloc] initWithObjects: 64 | [NSDictionary dictionaryWithObjectsAndKeys:[SSOAuthKitConfiguration consumerKey], @"value", @"oauth_consumer_key", @"key", nil], 65 | [NSDictionary dictionaryWithObjectsAndKeys:[signatureProvider name], @"value", @"oauth_signature_method", @"key", nil], 66 | [NSDictionary dictionaryWithObjectsAndKeys:timestamp, @"value", @"oauth_timestamp", @"key", nil], 67 | [NSDictionary dictionaryWithObjectsAndKeys:nonce, @"value", @"oauth_nonce", @"key", nil], 68 | [NSDictionary dictionaryWithObjectsAndKeys:@"1.0", @"value", @"oauth_version", @"key", nil], 69 | nil]; 70 | 71 | if (_token && [_token.key isEqualToString:@""] == NO) { 72 | [parameterPairs addObject:[NSDictionary dictionaryWithObjectsAndKeys:_token.key, @"value", @"oauth_token", @"key", nil]]; 73 | } 74 | 75 | // Add existing parameters 76 | if (postData) { 77 | [parameterPairs addObjectsFromArray:postData]; 78 | } 79 | 80 | // Sort and concatenate 81 | NSArray *sortedPairs = [parameterPairs sortedArrayUsingSelector:@selector(oaCompareKeys:)]; 82 | [parameterPairs release]; 83 | 84 | NSMutableArray *pieces = [[NSMutableArray alloc] init]; 85 | for (NSDictionary *pair in sortedPairs) { 86 | [pieces addObject:[NSString stringWithFormat:@"%@=%@", [[pair objectForKey:@"key"] URLEncodedString], [[pair objectForKey:@"value"] URLEncodedString]]]; 87 | } 88 | NSString *normalizedRequestParameters = [pieces componentsJoinedByString:@"&"]; 89 | [pieces release]; 90 | 91 | // OAuth Spec, Section 9.1.2 "Concatenate Request Elements" 92 | NSString *signatureBaseString = [NSString stringWithFormat:@"%@&%@&%@", self.requestMethod, 93 | [[self.url OAuthString] URLEncodedString], 94 | [normalizedRequestParameters URLEncodedString]]; 95 | 96 | // Sign 97 | // Secrets must be urlencoded before concatenated with '&' 98 | NSString *tokenSecret = _token ? [_token.secret URLEncodedString] : @""; 99 | NSString *secret = [NSString stringWithFormat:@"%@&%@", [[SSOAuthKitConfiguration consumerSecret] URLEncodedString], tokenSecret]; 100 | NSString *signature = [signatureProvider signClearText:signatureBaseString withSecret:secret]; 101 | 102 | // Set OAuth headers 103 | NSString *oauthToken = @""; 104 | if (_token && [_token.key isEqualToString:@""] == NO) { 105 | oauthToken = [NSString stringWithFormat:@"oauth_token=\"%@\", ", [_token.key URLEncodedString]]; 106 | } 107 | 108 | NSString *oauthHeader = [NSString stringWithFormat:@"OAuth oauth_nonce=\"%@\", oauth_signature_method=\"%@\", oauth_timestamp=\"%@\", oauth_consumer_key=\"%@\", %@oauth_signature=\"%@\", oauth_version=\"1.0\"", 109 | [nonce URLEncodedString], 110 | [[signatureProvider name] URLEncodedString], 111 | [timestamp URLEncodedString], 112 | [[SSOAuthKitConfiguration consumerKey] URLEncodedString], 113 | oauthToken, 114 | [signature URLEncodedString]]; 115 | 116 | // Clean up 117 | [signatureProvider release]; 118 | 119 | // Add the header 120 | [self addRequestHeader:@"Authorization" value:oauthHeader]; 121 | } 122 | 123 | @end 124 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOARequest.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSOARequest.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 1/25/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "ASIHTTPRequest.h" 10 | 11 | @class SSOAToken; 12 | 13 | @interface SSOARequest : ASIHTTPRequest { 14 | 15 | @private 16 | 17 | SSOAToken *_token; 18 | } 19 | 20 | @property (nonatomic, retain) SSOAToken *token; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOARequest.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSOARequest.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 1/25/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSOARequest.h" 10 | #import "SSOAToken.h" 11 | #import "SSOAuthKitConfiguration.h" 12 | #import "OAHMAC_SHA1SignatureProvider.h" 13 | #import "NSURL+OAuthString.h" 14 | #import 15 | 16 | @implementation SSOARequest 17 | 18 | @synthesize token = _token; 19 | 20 | #pragma mark - 21 | #pragma mark NSObject 22 | 23 | - (void)dealloc { 24 | self.token = nil; 25 | [super dealloc]; 26 | } 27 | 28 | 29 | 30 | #pragma mark - 31 | #pragma mark ASIHTTPRequest 32 | 33 | - (id)initWithURL:(NSURL *)newURL { 34 | if ((self = [super initWithURL:newURL])) { 35 | self.useCookiePersistence = NO; 36 | } 37 | return self; 38 | } 39 | 40 | 41 | - (NSString *)encodeURL:(NSString *)string { 42 | NSString *newString = [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR(":/?#[]@!$ &'()*+,;=\"<>%{}|\\^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)) autorelease]; 43 | if (newString) { 44 | return newString; 45 | } 46 | return @""; 47 | } 48 | 49 | 50 | - (void)buildRequestHeaders { 51 | [super buildRequestHeaders]; 52 | 53 | if ([SSOAuthKitConfiguration consumerKey] == nil || [SSOAuthKitConfiguration consumerSecret] == nil) { 54 | return; 55 | } 56 | 57 | // Signature provider 58 | id signatureProvider = [[OAHMAC_SHA1SignatureProvider alloc] init]; 59 | 60 | // Timestamp 61 | NSString *timestamp = [NSString stringWithFormat:@"%d", time(NULL)]; 62 | 63 | // Nonce 64 | CFUUIDRef theUUID = CFUUIDCreate(NULL); 65 | CFStringRef string = CFUUIDCreateString(NULL, theUUID); 66 | CFRelease(theUUID); 67 | NSString *nonce = [(NSString *)string autorelease]; 68 | 69 | // OAuth Spec, Section 9.1.1 "Normalize Request Parameters" 70 | // Build a sorted array of both request parameters and OAuth header parameters 71 | NSMutableArray *parameterPairs = [[NSMutableArray alloc] initWithObjects: 72 | [NSDictionary dictionaryWithObjectsAndKeys:[SSOAuthKitConfiguration consumerKey], @"value", @"oauth_consumer_key", @"key", nil], 73 | [NSDictionary dictionaryWithObjectsAndKeys:[signatureProvider name], @"value", @"oauth_signature_method", @"key", nil], 74 | [NSDictionary dictionaryWithObjectsAndKeys:timestamp, @"value", @"oauth_timestamp", @"key", nil], 75 | [NSDictionary dictionaryWithObjectsAndKeys:nonce, @"value", @"oauth_nonce", @"key", nil], 76 | [NSDictionary dictionaryWithObjectsAndKeys:@"1.0", @"value", @"oauth_version", @"key", nil], 77 | nil]; 78 | 79 | if ([_token.key isEqualToString:@""] == NO) { 80 | [parameterPairs addObject:[NSDictionary dictionaryWithObject:_token.key forKey:@"oauth_token"]]; 81 | } 82 | 83 | // Sort and concatenate 84 | NSMutableString *normalizedRequestParameters = [[NSMutableString alloc] init]; 85 | NSArray *sortedPairs = [parameterPairs sortedArrayUsingSelector:@selector(compare:)]; 86 | 87 | NSUInteger i = 0; 88 | NSUInteger count = [parameterPairs count] - 1; 89 | for (NSDictionary *pair in sortedPairs) { 90 | NSString *parameterString = [NSString stringWithFormat:@"%@=%@%@", [self encodeURL:[pair objectForKey:@"key"]], [self encodeURL:[pair objectForKey:@"value"]], (i < count ? @"&" : @"")]; 91 | [normalizedRequestParameters appendString:parameterString]; 92 | i++; 93 | } 94 | [parameterPairs release]; 95 | 96 | // OAuth Spec, Section 9.1.2 "Concatenate Request Elements" 97 | NSString *signatureBaseString = [NSString stringWithFormat:@"%@&%@&%@", self.requestMethod, 98 | [[self.url OAuthString] URLEncodedString], 99 | [normalizedRequestParameters URLEncodedString]]; 100 | [normalizedRequestParameters release]; 101 | 102 | // Sign 103 | // Secrets must be urlencoded before concatenated with '&' 104 | NSString *signature = [signatureProvider signClearText:signatureBaseString withSecret: 105 | [NSString stringWithFormat:@"%@&%@", [[SSOAuthKitConfiguration consumerSecret] URLEncodedString], 106 | [_token.secret URLEncodedString]]]; 107 | 108 | // Set OAuth headers 109 | NSString *oauthToken = @""; 110 | if ([_token.key isEqualToString:@""] == NO) { 111 | oauthToken = [NSString stringWithFormat:@"oauth_token=\"%@\", ", [_token.key URLEncodedString]]; 112 | } 113 | 114 | NSString *oauthHeader = [NSString stringWithFormat:@"OAuth oauth_consumer_key=\"%@\", %@oauth_signature_method=\"%@\", oauth_signature=\"%@\", oauth_timestamp=\"%@\", oauth_nonce=\"%@\", oauth_version=\"1.0\"", 115 | [[SSOAuthKitConfiguration consumerKey] URLEncodedString], 116 | oauthToken, 117 | [[signatureProvider name] URLEncodedString], 118 | [signature URLEncodedString], 119 | timestamp, 120 | nonce]; 121 | 122 | // Clean up 123 | [signatureProvider release]; 124 | 125 | // Add the header 126 | [self addRequestHeader:@"Authorization" value:oauthHeader]; 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAToken.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAToken.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSOAConsumer.h" 10 | 11 | @interface SSOAToken : SSOAConsumer { 12 | 13 | } 14 | 15 | - (id)initWithUserDefaultsUsingServiceProviderName:(NSString *)provider prefix:(NSString *)prefix; 16 | 17 | // Utilities 18 | - (void)storeInUserDefaultsWithServiceProviderName:(NSString *)provider prefix:(NSString *)prefix; 19 | - (NSString *)URLEncodedValue; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAToken.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAToken.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSOAToken.h" 10 | 11 | @implementation SSOAToken 12 | 13 | #pragma mark - 14 | #pragma mark Initializers 15 | 16 | - (id)initWithUserDefaultsUsingServiceProviderName:(NSString *)provider prefix:(NSString *)prefix { 17 | NSString *aKey = [[NSUserDefaults standardUserDefaults] stringForKey:[NSString stringWithFormat:@"OAUTH_%@_%@_KEY", prefix, provider]]; 18 | NSString *aSecret = [[NSUserDefaults standardUserDefaults] stringForKey:[NSString stringWithFormat:@"OAUTH_%@_%@_SECRET", prefix, provider]]; 19 | 20 | self = [self initWithKey:aKey secret:aSecret]; 21 | return self; 22 | } 23 | 24 | 25 | #pragma mark - 26 | #pragma mark Utilities 27 | 28 | - (void)storeInUserDefaultsWithServiceProviderName:(NSString *)provider prefix:(NSString *)prefix { 29 | NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; 30 | [userDefaults setObject:self.key forKey:[NSString stringWithFormat:@"OAUTH_%@_%@_KEY", prefix, provider]]; 31 | [userDefaults setObject:self.secret forKey:[NSString stringWithFormat:@"OAUTH_%@_%@_SECRET", prefix, provider]]; 32 | [userDefaults synchronize]; 33 | } 34 | 35 | 36 | - (NSString *)URLEncodedValue { 37 | return [NSString stringWithFormat:@"oauth_token=%@&oauth_token_secret=%@", self.key, self.secret]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAuthKit.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAuthKit.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 11/17/09. 6 | // Copyright 2009-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #if 1 10 | 11 | #import "SSOAuthKitConfiguration.h" 12 | #import "SSOAConsumer.h" 13 | #import "SSOAFormRequest.h" 14 | #import "SSOARequest.h" 15 | #import "SSOAToken.h" 16 | #import "SSTwitterAuthViewController.h" 17 | #import "SSTwitterAuthViewControllerDelegate.h" 18 | #import "SSTwitterOAuthViewController.h" 19 | #import "SSTwitterXAuthViewController.h" 20 | 21 | #else 22 | 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAuthKitConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAuthKitConfiguration.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | @class SSOAConsumer; 10 | 11 | @interface SSOAuthKitConfiguration : NSObject 12 | 13 | + (SSOAConsumer *)consumer; 14 | 15 | + (void)setConsumerKey:(NSString *)key secret:(NSString *)secret; 16 | 17 | + (void)setConsumerKey:(NSString *)key; 18 | + (NSString *)consumerKey; 19 | 20 | + (void)setConsumerSecret:(NSString *)secret; 21 | + (NSString *)consumerSecret; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /SSOAuthKit/SSOAuthKitConfiguration.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSOAuthKitConfiguration.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright 2010-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSOAuthKitConfiguration.h" 10 | #import "SSOAConsumer.h" 11 | 12 | static NSString *SSOAuthKitConfigurationConsumerKey = nil; 13 | static NSString *SSOAuthKitConfigurationConsumerSecret = nil; 14 | 15 | @implementation SSOAuthKitConfiguration 16 | 17 | + (SSOAConsumer *)consumer { 18 | return [[[SSOAConsumer alloc] initWithKey:[self consumerKey] secret:[self consumerSecret]] autorelease]; 19 | } 20 | 21 | 22 | + (void)setConsumerKey:(NSString *)key secret:(NSString *)secret { 23 | [self setConsumerKey:key]; 24 | [self setConsumerSecret:secret]; 25 | } 26 | 27 | 28 | + (void)setConsumerKey:(NSString *)key { 29 | if (key == SSOAuthKitConfigurationConsumerKey) { 30 | return; 31 | } 32 | [SSOAuthKitConfigurationConsumerKey release]; 33 | SSOAuthKitConfigurationConsumerKey = [key retain]; 34 | } 35 | 36 | 37 | + (NSString *)consumerKey { 38 | return SSOAuthKitConfigurationConsumerKey; 39 | } 40 | 41 | 42 | + (void)setConsumerSecret:(NSString *)secret { 43 | if (secret == SSOAuthKitConfigurationConsumerSecret) { 44 | return; 45 | } 46 | [SSOAuthKitConfigurationConsumerSecret release]; 47 | SSOAuthKitConfigurationConsumerSecret = [secret retain]; 48 | } 49 | 50 | 51 | + (NSString *)consumerSecret { 52 | return SSOAuthKitConfigurationConsumerSecret; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterAuthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterAuthViewController.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 5/24/11. 6 | // Copyright 2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "ASIHTTPRequestDelegate.h" 10 | 11 | @protocol SSTwitterAuthViewControllerDelegate; 12 | @class SSOAFormRequest; 13 | @class SSOAToken; 14 | @class SSLoadingView; 15 | 16 | @interface SSTwitterAuthViewController : UIViewController { 17 | 18 | @private 19 | 20 | id _delegate; 21 | SSOAFormRequest *_request; 22 | SSOAToken *_accessToken; 23 | SSLoadingView *_loadingView; 24 | } 25 | 26 | @property (nonatomic, assign) id delegate; 27 | 28 | - (id)initWithDelegate:(id)aDelegate; 29 | - (void)cancel:(id)sender; 30 | 31 | #pragma mark Internal 32 | 33 | // Use the following if you are subclassing 34 | 35 | @property (nonatomic, retain) SSOAFormRequest *request; 36 | @property (nonatomic, retain) SSOAToken *accessToken; 37 | @property (nonatomic, retain, readonly) SSLoadingView *loadingView; 38 | 39 | - (void)cancelRequest; 40 | - (void)requestUser; 41 | - (void)failWithError:(NSError *)error; 42 | - (void)failWithErrorString:(NSString *)message code:(NSInteger)code; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterAuthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterAuthViewController.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 5/24/11. 6 | // Copyright 2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSTwitterAuthViewController.h" 10 | #import "SSTwitterAuthViewControllerDelegate.h" 11 | #import "SSOAFormRequest.h" 12 | #import "SSOAToken.h" 13 | #import "JSONKit.h" 14 | #import 15 | 16 | static NSString *kSSTwitterAuthViewControllerErrorDomain = @"com.samsoffes.sstwitteroauthviewcontroller"; 17 | 18 | @implementation SSTwitterAuthViewController 19 | 20 | @synthesize delegate = _delegate; 21 | @synthesize request = _request; 22 | @synthesize accessToken = _accessToken; 23 | @synthesize loadingView = _loadingView; 24 | 25 | #pragma mark - 26 | #pragma mark NSObject 27 | 28 | - (id)init { 29 | if ((self = [super init])) { 30 | self.modalPresentationStyle = UIModalPresentationFormSheet; 31 | } 32 | return self; 33 | } 34 | 35 | 36 | - (void)dealloc { 37 | _delegate = nil; 38 | [self cancelRequest]; 39 | [_loadingView release]; 40 | self.accessToken = nil; 41 | [super dealloc]; 42 | } 43 | 44 | 45 | #pragma mark - 46 | #pragma mark UIViewController 47 | 48 | - (void)viewDidLoad { 49 | [super viewDidLoad]; 50 | 51 | self.title = @"Twitter"; 52 | 53 | // Cancel button 54 | UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancel:)]; 55 | self.navigationItem.leftBarButtonItem = cancelButton; 56 | [cancelButton release]; 57 | 58 | // Loading 59 | _loadingView = [[SSLoadingView alloc] initWithFrame:CGRectZero]; 60 | _loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 61 | _loadingView.backgroundColor = [UIColor clearColor]; 62 | _loadingView.opaque = NO; 63 | } 64 | 65 | 66 | #pragma mark - 67 | #pragma mark Initalizer 68 | 69 | - (id)initWithDelegate:(id)aDelegate { 70 | if ((self = [self init])) { 71 | self.delegate = aDelegate; 72 | } 73 | return self; 74 | } 75 | 76 | 77 | #pragma mark - 78 | #pragma mark Actions 79 | 80 | - (void)cancel:(id)sender { 81 | [self cancelRequest]; 82 | 83 | if ([_delegate respondsToSelector:@selector(twitterAuthViewControllerDidCancel:)]) { 84 | [_delegate twitterAuthViewControllerDidCancel:self]; 85 | } 86 | } 87 | 88 | 89 | #pragma mark - 90 | #pragma mark Internal 91 | 92 | - (void)cancelRequest { 93 | self.request.delegate = nil; 94 | [self.request cancel]; 95 | self.request = nil; 96 | } 97 | 98 | 99 | - (void)requestUser { 100 | [self cancelRequest]; 101 | 102 | _loadingView.text = @"Saving..."; 103 | 104 | NSURL *url = [[NSURL alloc] initWithString:@"https://api.twitter.com/1/account/verify_credentials.json"]; 105 | 106 | SSOAFormRequest *aRequest = [[SSOAFormRequest alloc] initWithURL:url]; 107 | aRequest.requestMethod = @"GET"; 108 | aRequest.token = _accessToken; 109 | aRequest.delegate = self; 110 | self.request = aRequest; 111 | [aRequest release]; 112 | [url release]; 113 | 114 | [self.request startAsynchronous]; 115 | } 116 | 117 | 118 | - (void)failWithError:(NSError *)error { 119 | if ([_delegate respondsToSelector:@selector(twitterAuthViewController:didFailWithError:)]) { 120 | [_delegate twitterAuthViewController:self didFailWithError:error]; 121 | } 122 | } 123 | 124 | 125 | - (void)failWithErrorString:(NSString *)message code:(NSInteger)code { 126 | if ([_delegate respondsToSelector:@selector(twitterAuthViewController:didFailWithError:)]) { 127 | NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey, nil]; 128 | NSError *error = [NSError errorWithDomain:kSSTwitterAuthViewControllerErrorDomain code:code userInfo:userInfo]; 129 | [_delegate twitterAuthViewController:self didFailWithError:error]; 130 | } 131 | } 132 | 133 | 134 | #pragma mark - 135 | #pragma mark ASIHTTPRequestDelegate 136 | 137 | - (void)requestStarted:(ASIHTTPRequest *)aRequest { 138 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; 139 | } 140 | 141 | 142 | - (void)requestFailed:(ASIHTTPRequest *)aRequest { 143 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 144 | [self failWithError:[aRequest error]]; 145 | } 146 | 147 | 148 | - (void)requestFinished:(ASIHTTPRequest *)aRequest { 149 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 150 | 151 | if ([aRequest responseStatusCode] >= 500) { 152 | [self failWithErrorString:@"Something went technically wrong on Twitter's end. Maybe try again later." code:-2]; 153 | return; 154 | } 155 | 156 | NSString *path = [[aRequest url] path]; 157 | 158 | // Get user 159 | if ([path isEqualToString:@"/1/account/verify_credentials.json"]) { 160 | NSError *jsonError = nil; 161 | NSDictionary *dictionary = [[aRequest responseData] objectFromJSONDataWithParseOptions:0 error:&jsonError]; 162 | if (!dictionary) { 163 | // Pass access token along since we successfully got it already 164 | NSDictionary *userInfo = [[NSDictionary alloc] initWithObjectsAndKeys: 165 | jsonError, NSUnderlyingErrorKey, 166 | _accessToken, @"accessToken", 167 | @"Failed to get Twitter profile.", NSLocalizedDescriptionKey, 168 | nil]; 169 | NSError *error = [NSError errorWithDomain:kSSTwitterAuthViewControllerErrorDomain code:-3 userInfo:userInfo]; 170 | [userInfo release]; 171 | [self failWithError:error]; 172 | return; 173 | } 174 | 175 | // Notify delegate 176 | if ([self.delegate respondsToSelector:@selector(twitterAuthViewController:didAuthorizeWithAccessToken:userDictionary:)]) { 177 | [self.delegate twitterAuthViewController:self didAuthorizeWithAccessToken:_accessToken userDictionary:dictionary]; 178 | } 179 | } 180 | } 181 | 182 | @end 183 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterAuthViewControllerDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterAuthViewControllerDelegate.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 5/24/11. 6 | // Copyright 2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | @class SSOAToken; 10 | 11 | @protocol SSTwitterAuthViewControllerDelegate 12 | 13 | @optional 14 | 15 | - (void)twitterAuthViewControllerDidCancel:(UIViewController *)viewController; 16 | - (void)twitterAuthViewController:(UIViewController *)viewController didFailWithError:(NSError *)error; 17 | - (void)twitterAuthViewController:(UIViewController *)viewController didAuthorizeWithAccessToken:(SSOAToken *)accessToken userDictionary:(NSDictionary *)userDictionary; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterOAuthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterOAuthViewController.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 11/3/09. 6 | // Copyright 2009-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSTwitterAuthViewController.h" 10 | 11 | @class SSOAToken; 12 | 13 | @interface SSTwitterOAuthViewController : SSTwitterAuthViewController { 14 | 15 | @private 16 | 17 | UIWebView *_authorizationView; 18 | SSOAToken *_requestToken; 19 | BOOL _verifying; 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterOAuthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterOAuthViewController.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 11/3/09. 6 | // Copyright 2009-2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSTwitterOAuthViewController.h" 10 | #import "SSOAuthKitConfiguration.h" 11 | #import "SSOAToken.h" 12 | #import "SSOAFormRequest.h" 13 | #import "SSTwitterAuthViewControllerDelegate.h" 14 | #import "ASIHTTPRequest.h" 15 | #import "JSONKit.h" 16 | #import 17 | #import 18 | #import 19 | #import 20 | 21 | @interface SSTwitterOAuthViewController (Private) 22 | - (void)_requestRequestToken; 23 | - (void)_requestAccessToken; 24 | - (void)_verifyAccessToken:(NSString *)verifier; 25 | @end 26 | 27 | @implementation SSTwitterOAuthViewController 28 | 29 | #pragma mark - 30 | #pragma mark NSObject 31 | 32 | - (void)dealloc { 33 | [_authorizationView release]; 34 | [_requestToken release]; 35 | [super dealloc]; 36 | } 37 | 38 | 39 | #pragma mark - 40 | #pragma mark UIViewController 41 | 42 | - (void)viewDidLoad { 43 | [super viewDidLoad]; 44 | 45 | // Background image 46 | UIImageView *backgroundView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 100.0f)]; 47 | backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; 48 | backgroundView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"images/twitter_oauth_background.png" bundle:@"SSOAuthKit.bundle"]]; 49 | backgroundView.opaque = YES; 50 | [self.view addSubview:backgroundView]; 51 | [backgroundView release]; 52 | self.view.backgroundColor = [UIColor colorWithRed:0.753f green:0.875f blue:0.925f alpha:1.0f]; 53 | 54 | // Loading 55 | self.loadingView.frame = CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height); 56 | [self.view addSubview:self.loadingView]; 57 | 58 | // Web view 59 | _authorizationView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height)]; 60 | _authorizationView.dataDetectorTypes = UIDataDetectorTypeNone; 61 | _authorizationView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 62 | _authorizationView.delegate = self; 63 | _authorizationView.alpha = 0.0f; 64 | 65 | [self _requestRequestToken]; 66 | } 67 | 68 | 69 | #pragma mark - 70 | #pragma mark Private Methods 71 | 72 | // *** Step 1 73 | - (void)_requestRequestToken { 74 | [self cancelRequest]; 75 | 76 | // Update loading text 77 | self.loadingView.text = @"Requesting token..."; 78 | 79 | // Perform request for request token 80 | NSURL *url = [[NSURL alloc] initWithString:@"https://api.twitter.com/oauth/request_token"]; 81 | SSOAFormRequest *aRequest = [[SSOAFormRequest alloc] initWithURL:url]; 82 | aRequest.delegate = self; 83 | self.request = aRequest; 84 | [aRequest release]; 85 | [url release]; 86 | 87 | [self.request startAsynchronous]; 88 | } 89 | 90 | 91 | // *** Step 2 92 | - (void)_requestAccessToken { 93 | self.loadingView.text = @"Authorizing..."; 94 | 95 | NSString *urlString = [[NSString alloc] initWithFormat:@"https://api.twitter.com/oauth/authorize?oauth_token=%@&oauth_callback=oob", _requestToken.key]; 96 | NSURL *url = [[NSURL alloc] initWithString:urlString]; 97 | NSURLRequest *aRequest = [[NSURLRequest alloc] initWithURL:url]; 98 | [url release]; 99 | [urlString release]; 100 | 101 | // Setup webView 102 | CGRect frame = self.view.frame; 103 | _authorizationView = [[UIWebView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, frame.size.width, frame.size.height)]; 104 | _authorizationView.dataDetectorTypes = UIDataDetectorTypeNone; 105 | _authorizationView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 106 | _authorizationView.delegate = self; 107 | _authorizationView.alpha = 0.0f; 108 | [_authorizationView loadRequest:aRequest]; 109 | [self.view addSubview:_authorizationView]; 110 | 111 | [aRequest release]; 112 | } 113 | 114 | 115 | // *** Step 3 116 | - (void)_verifyAccessToken:(NSString *)verifier { 117 | _verifying = YES; 118 | self.loadingView.text = @"Verifying..."; 119 | 120 | [_authorizationView fadeOut]; 121 | [_authorizationView release]; 122 | _authorizationView = nil; 123 | 124 | [self cancelRequest]; 125 | 126 | NSURL *url = [[NSURL alloc] initWithString:@"https://api.twitter.com/oauth/access_token"]; 127 | 128 | SSOAFormRequest *aRequest = [[SSOAFormRequest alloc] initWithURL:url]; 129 | aRequest.token = _requestToken; 130 | aRequest.delegate = self; 131 | [aRequest addPostValue:verifier forKey:@"oauth_verifier"]; 132 | self.request = aRequest; 133 | [aRequest release]; 134 | [url release]; 135 | 136 | [self.request startAsynchronous]; 137 | } 138 | 139 | 140 | #pragma mark - 141 | #pragma mark ASIHTTPRequestDelegate 142 | 143 | - (void)requestFinished:(ASIHTTPRequest *)aRequest { 144 | [super requestFinished:aRequest]; 145 | 146 | NSString *path = [[aRequest url] path]; 147 | 148 | // *** Step 1 - Request token 149 | if ([path isEqualToString:@"/oauth/request_token"]) { 150 | // Create request token 151 | NSString *httpBody = [aRequest responseString]; 152 | 153 | // Check for token error 154 | if ([httpBody isEqualToString:@"Failed to validate oauth signature and token"]) { 155 | [self failWithErrorString:httpBody code:-1]; 156 | return; 157 | } 158 | 159 | // Get token 160 | SSOAToken *aToken = [[SSOAToken alloc] initWithHTTPResponseBody:httpBody]; 161 | 162 | // Check for token error 163 | if (!aToken.key || !aToken.secret) { 164 | [aToken release]; 165 | [self failWithErrorString:@"The request token could not be generated" code:-1]; 166 | return; 167 | } 168 | 169 | // Store token 170 | _requestToken = [aToken retain]; 171 | [aToken release]; 172 | 173 | // Start authorizing 174 | [self _requestAccessToken]; 175 | return; 176 | } 177 | 178 | // *** Step 2 - Authorize (web view handles this) 179 | 180 | // *** Step 3 - Verify token 181 | else if ([path isEqualToString:@"/oauth/access_token"]) { 182 | 183 | // Get token 184 | SSOAToken *aToken = [[SSOAToken alloc] initWithHTTPResponseBody:[aRequest responseString]]; 185 | 186 | // Check for token error 187 | if (aToken == nil) { 188 | [self failWithErrorString:@"The access token could not be generated" code:-1]; 189 | return; 190 | } 191 | 192 | self.accessToken = aToken; 193 | [aToken release]; 194 | 195 | // Get user dictionary 196 | [self requestUser]; 197 | return; 198 | } 199 | 200 | // *** Step 2 - Get user (super class handles this) 201 | } 202 | 203 | 204 | #pragma mark - 205 | #pragma mark UIWebViewDelegate 206 | 207 | - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error { 208 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 209 | [self failWithError:error]; 210 | } 211 | 212 | 213 | - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)aRequest navigationType:(UIWebViewNavigationType)navigationType { 214 | if (self.accessToken) { 215 | return NO; 216 | } 217 | 218 | NSURL *url = [aRequest URL]; 219 | NSLog(@"url: %@", url); 220 | 221 | // Allow the user to change users 222 | if ([[url host] isEqualToString:@"api.twitter.com"] && [[url path] isEqualToString:@"/logout"]) { 223 | return YES; 224 | } 225 | 226 | NSString *body = [[NSString alloc] initWithData:[aRequest HTTPBody] encoding:NSUTF8StringEncoding]; 227 | NSDictionary *params = [NSDictionary dictionaryWithFormEncodedString:body]; 228 | [body release]; 229 | 230 | // TODO: allow signup too 231 | if ([[url host] isEqualToString:@"api.twitter.com"] && [[url path] isEqualToString:@"/oauth/authorize"]) { 232 | // Handle cancel 233 | if ([params objectForKey:@"cancel"]) { 234 | [self cancel:self]; 235 | return NO; 236 | } 237 | 238 | [_authorizationView fadeOut]; 239 | return YES; 240 | } 241 | 242 | // Check for completion redirect instead of pin 243 | NSString *currentURLString = [_authorizationView stringByEvaluatingJavaScriptFromString:@"location.href"]; 244 | if ([currentURLString isEqualToString:@"https://api.twitter.com/oauth/authorize"]) { 245 | [self _verifyAccessToken:[params objectForKey:@"oauth_verifier"]]; 246 | } 247 | 248 | return NO; 249 | } 250 | 251 | 252 | - (void)webViewDidFinishLoad:(UIWebView *)webView { 253 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 254 | 255 | // Check for pin 256 | NSString *pin = [_authorizationView stringByEvaluatingJavaScriptFromString:@"document.querySelectorAll.apply(document, ['div#oauth_pin code'])[0].innerHTML"]; 257 | if ([pin length] == 7) { 258 | [self _verifyAccessToken:pin]; 259 | return; 260 | } 261 | 262 | // Fade in 263 | if (!self.accessToken && _verifying == NO) { 264 | [_authorizationView fadeIn]; 265 | } 266 | } 267 | 268 | 269 | - (void)webViewDidStartLoad:(UIWebView *)webView { 270 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES]; 271 | } 272 | 273 | @end 274 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterXAuthViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterXAuthViewController.h 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 5/24/11. 6 | // Copyright 2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSTwitterAuthViewController.h" 10 | 11 | @interface SSTwitterXAuthViewController : SSTwitterAuthViewController { 12 | 13 | @private 14 | 15 | UITableView *_tableView; 16 | UITextField *_usernameTextField; 17 | UITextField *_passwordTextField; 18 | } 19 | 20 | @property (nonatomic, retain, readonly) UITextField *usernameTextField; 21 | @property (nonatomic, retain, readonly) UITextField *passwordTextField; 22 | @property (nonatomic, retain, readonly) UITableView *tableView; 23 | 24 | - (void)signIn:(id)sender; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /SSOAuthKit/SSTwitterXAuthViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSTwitterXAuthViewController.m 3 | // SSOAuthKit 4 | // 5 | // Created by Sam Soffes on 5/24/11. 6 | // Copyright 2011 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSTwitterXAuthViewController.h" 10 | #import "SSOAFormRequest.h" 11 | #import "SSOAToken.h" 12 | #import 13 | #import 14 | 15 | @implementation SSTwitterXAuthViewController 16 | 17 | @synthesize usernameTextField = _usernameTextField; 18 | @synthesize passwordTextField = _passwordTextField; 19 | @synthesize tableView = _tableView; 20 | 21 | #pragma mark - 22 | #pragma mark NSObject 23 | 24 | - (void)dealloc { 25 | _tableView.dataSource = nil; 26 | _tableView.delegate = nil; 27 | [_tableView release]; 28 | 29 | [_usernameTextField release]; 30 | [_passwordTextField release]; 31 | 32 | [super dealloc]; 33 | } 34 | 35 | 36 | #pragma mark - 37 | #pragma mark UIViewController 38 | 39 | - (void)loadView { 40 | _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped]; 41 | _tableView.dataSource = self; 42 | _tableView.delegate = self; 43 | self.view = _tableView; 44 | } 45 | 46 | 47 | - (void)viewDidLoad { 48 | [super viewDidLoad]; 49 | 50 | UIBarButtonItem *signInButton = [[UIBarButtonItem alloc] initWithTitle:@"Sign In" style:UIBarButtonItemStyleDone target:self action:@selector(signIn:)]; 51 | signInButton.enabled = NO; 52 | self.navigationItem.rightBarButtonItem = signInButton; 53 | [signInButton release]; 54 | 55 | UIColor *textColor = [UIColor colorWithRed:0.102f green:0.310f blue:0.498f alpha:1.0f]; 56 | 57 | _usernameTextField = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 195.0f, 43.0f)]; 58 | _usernameTextField.backgroundColor = [UIColor clearColor]; 59 | _usernameTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 60 | _usernameTextField.keyboardType = UIKeyboardTypeEmailAddress; 61 | _usernameTextField.delegate = self; 62 | _usernameTextField.autocorrectionType = UITextAutocorrectionTypeNo; 63 | _usernameTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; 64 | _usernameTextField.returnKeyType = UIReturnKeyNext; 65 | _usernameTextField.textColor = textColor; 66 | 67 | _passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 195.0f, 42.0f)]; 68 | _passwordTextField.backgroundColor = [UIColor clearColor]; 69 | _passwordTextField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 70 | _passwordTextField.secureTextEntry = YES; 71 | _passwordTextField.delegate = self; 72 | _passwordTextField.returnKeyType = UIReturnKeyGo; 73 | _passwordTextField.textColor = textColor; 74 | 75 | self.loadingView.frame = CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 44.0f); 76 | self.loadingView.alpha = 0.0f; 77 | self.loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth; 78 | 79 | UIView *footer = [[UIView alloc] initWithFrame:CGRectZero]; 80 | [footer addSubview:self.loadingView]; 81 | _tableView.tableFooterView = footer; 82 | [footer release]; 83 | } 84 | 85 | 86 | - (void)viewWillAppear:(BOOL)animated { 87 | [super viewWillAppear:animated]; 88 | 89 | [_usernameTextField becomeFirstResponder]; 90 | } 91 | 92 | 93 | #pragma mark - 94 | #pragma mark Actions 95 | 96 | - (void)signIn:(id)sender { 97 | [self cancelRequest]; 98 | 99 | _usernameTextField.enabled = NO; 100 | _passwordTextField.enabled = NO; 101 | self.navigationItem.rightBarButtonItem.enabled = NO; 102 | 103 | [self.loadingView fadeIn]; 104 | self.loadingView.text = @"Signing in..."; 105 | 106 | NSURL *url = [[NSURL alloc] initWithString:@"https://api.twitter.com/oauth/access_token"]; 107 | 108 | SSOAFormRequest *aRequest = [[SSOAFormRequest alloc] initWithURL:url]; 109 | aRequest.delegate = self; 110 | 111 | [aRequest addPostValue:_usernameTextField.text forKey:@"x_auth_username"]; 112 | [aRequest addPostValue:_passwordTextField.text forKey:@"x_auth_password"]; 113 | [aRequest addPostValue:@"client_auth" forKey:@"x_auth_mode"]; 114 | self.request = aRequest; 115 | [aRequest release]; 116 | [url release]; 117 | 118 | [self.request startAsynchronous]; 119 | } 120 | 121 | 122 | #pragma mark - 123 | #pragma mark UITableViewDataSource 124 | 125 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 126 | return 2; 127 | } 128 | 129 | 130 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 131 | static NSString *cellIdentifier = @"cellIdentifier"; 132 | 133 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 134 | if (!cell) { 135 | cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier] autorelease]; 136 | cell.selectionStyle = UITableViewCellSelectionStyleNone; 137 | } 138 | 139 | // Username 140 | if (indexPath.row == 0) { 141 | cell.textLabel.text = @"Username"; 142 | cell.accessoryView = _usernameTextField; 143 | } 144 | 145 | // Password 146 | else if (indexPath.row == 1) { 147 | cell.textLabel.text = @"Password"; 148 | cell.accessoryView = _passwordTextField; 149 | } 150 | 151 | return cell; 152 | } 153 | 154 | 155 | #pragma mark - 156 | #pragma mark UITextFieldDelegate 157 | 158 | - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { 159 | NSInteger usernameLength = [_usernameTextField.text length]; 160 | NSInteger passwordLength = [_passwordTextField.text length]; 161 | 162 | if (textField == _usernameTextField) { 163 | usernameLength += [string length] - range.length; 164 | } else { 165 | passwordLength += [string length] - range.length; 166 | } 167 | 168 | self.navigationItem.rightBarButtonItem.enabled = (usernameLength > 0 && passwordLength > 0); 169 | return YES; 170 | } 171 | 172 | 173 | - (BOOL)textFieldShouldReturn:(UITextField *)textField { 174 | if (textField == _usernameTextField) { 175 | [_passwordTextField becomeFirstResponder]; 176 | } else if (textField == _passwordTextField) { 177 | [self signIn:_passwordTextField]; 178 | } 179 | return YES; 180 | } 181 | 182 | 183 | #pragma mark - 184 | #pragma mark UIAlertViewDelegate 185 | 186 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex { 187 | [_usernameTextField becomeFirstResponder]; 188 | } 189 | 190 | 191 | #pragma mark - 192 | #pragma mark ASIHTTPRequestDelegate 193 | 194 | - (void)requestFailed:(ASIHTTPRequest *)aRequest { 195 | [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO]; 196 | 197 | // Handle bad password 198 | if ([aRequest responseStatusCode] == 401) { 199 | [self.loadingView fadeOut]; 200 | 201 | _usernameTextField.enabled = YES; 202 | _passwordTextField.enabled = YES; 203 | self.navigationItem.rightBarButtonItem.enabled = YES; 204 | 205 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your username and password could not be verified. Double check that you entered them correctly and try again." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; 206 | [alert show]; 207 | [alert release]; 208 | return; 209 | } 210 | 211 | [self failWithError:[aRequest error]]; 212 | } 213 | 214 | 215 | - (void)requestFinished:(ASIHTTPRequest *)aRequest { 216 | [super requestFinished:aRequest]; 217 | 218 | if ([[[aRequest url] path] isEqualToString:@"/oauth/access_token"]) { 219 | // Create access token 220 | SSOAToken *aToken = [[SSOAToken alloc] initWithHTTPResponseBody:[aRequest responseString]]; 221 | 222 | // Check for token error 223 | if (aToken == nil) { 224 | [self failWithErrorString:@"The access token could not be generated" code:-1]; 225 | return; 226 | } 227 | 228 | self.accessToken = aToken; 229 | [aToken release]; 230 | 231 | // Get user dictionary 232 | [self requestUser]; 233 | } 234 | } 235 | 236 | @end 237 | -------------------------------------------------------------------------------- /SSOAuthKit/Vendor/OAuthConsumer/Base64Transcoder.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Base64Transcoder.c 3 | * Base64Test 4 | * 5 | * Created by Jonathan Wight on Tue Mar 18 2003. 6 | * Copyright (c) 2003 Toxic Software. All rights reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | 28 | #include "Base64Transcoder.h" 29 | 30 | #include 31 | #include 32 | 33 | const u_int8_t kBase64EncodeTable[64] = { 34 | /* 0 */ 'A', /* 1 */ 'B', /* 2 */ 'C', /* 3 */ 'D', 35 | /* 4 */ 'E', /* 5 */ 'F', /* 6 */ 'G', /* 7 */ 'H', 36 | /* 8 */ 'I', /* 9 */ 'J', /* 10 */ 'K', /* 11 */ 'L', 37 | /* 12 */ 'M', /* 13 */ 'N', /* 14 */ 'O', /* 15 */ 'P', 38 | /* 16 */ 'Q', /* 17 */ 'R', /* 18 */ 'S', /* 19 */ 'T', 39 | /* 20 */ 'U', /* 21 */ 'V', /* 22 */ 'W', /* 23 */ 'X', 40 | /* 24 */ 'Y', /* 25 */ 'Z', /* 26 */ 'a', /* 27 */ 'b', 41 | /* 28 */ 'c', /* 29 */ 'd', /* 30 */ 'e', /* 31 */ 'f', 42 | /* 32 */ 'g', /* 33 */ 'h', /* 34 */ 'i', /* 35 */ 'j', 43 | /* 36 */ 'k', /* 37 */ 'l', /* 38 */ 'm', /* 39 */ 'n', 44 | /* 40 */ 'o', /* 41 */ 'p', /* 42 */ 'q', /* 43 */ 'r', 45 | /* 44 */ 's', /* 45 */ 't', /* 46 */ 'u', /* 47 */ 'v', 46 | /* 48 */ 'w', /* 49 */ 'x', /* 50 */ 'y', /* 51 */ 'z', 47 | /* 52 */ '0', /* 53 */ '1', /* 54 */ '2', /* 55 */ '3', 48 | /* 56 */ '4', /* 57 */ '5', /* 58 */ '6', /* 59 */ '7', 49 | /* 60 */ '8', /* 61 */ '9', /* 62 */ '+', /* 63 */ '/' 50 | }; 51 | 52 | /* 53 | -1 = Base64 end of data marker. 54 | -2 = White space (tabs, cr, lf, space) 55 | -3 = Noise (all non whitespace, non-base64 characters) 56 | -4 = Dangerous noise 57 | -5 = Illegal noise (null byte) 58 | */ 59 | 60 | const int8_t kBase64DecodeTable[128] = { 61 | /* 0x00 */ -5, /* 0x01 */ -3, /* 0x02 */ -3, /* 0x03 */ -3, 62 | /* 0x04 */ -3, /* 0x05 */ -3, /* 0x06 */ -3, /* 0x07 */ -3, 63 | /* 0x08 */ -3, /* 0x09 */ -2, /* 0x0a */ -2, /* 0x0b */ -2, 64 | /* 0x0c */ -2, /* 0x0d */ -2, /* 0x0e */ -3, /* 0x0f */ -3, 65 | /* 0x10 */ -3, /* 0x11 */ -3, /* 0x12 */ -3, /* 0x13 */ -3, 66 | /* 0x14 */ -3, /* 0x15 */ -3, /* 0x16 */ -3, /* 0x17 */ -3, 67 | /* 0x18 */ -3, /* 0x19 */ -3, /* 0x1a */ -3, /* 0x1b */ -3, 68 | /* 0x1c */ -3, /* 0x1d */ -3, /* 0x1e */ -3, /* 0x1f */ -3, 69 | /* ' ' */ -2, /* '!' */ -3, /* '"' */ -3, /* '#' */ -3, 70 | /* '$' */ -3, /* '%' */ -3, /* '&' */ -3, /* ''' */ -3, 71 | /* '(' */ -3, /* ')' */ -3, /* '*' */ -3, /* '+' */ 62, 72 | /* ',' */ -3, /* '-' */ -3, /* '.' */ -3, /* '/' */ 63, 73 | /* '0' */ 52, /* '1' */ 53, /* '2' */ 54, /* '3' */ 55, 74 | /* '4' */ 56, /* '5' */ 57, /* '6' */ 58, /* '7' */ 59, 75 | /* '8' */ 60, /* '9' */ 61, /* ':' */ -3, /* ';' */ -3, 76 | /* '<' */ -3, /* '=' */ -1, /* '>' */ -3, /* '?' */ -3, 77 | /* '@' */ -3, /* 'A' */ 0, /* 'B' */ 1, /* 'C' */ 2, 78 | /* 'D' */ 3, /* 'E' */ 4, /* 'F' */ 5, /* 'G' */ 6, 79 | /* 'H' */ 7, /* 'I' */ 8, /* 'J' */ 9, /* 'K' */ 10, 80 | /* 'L' */ 11, /* 'M' */ 12, /* 'N' */ 13, /* 'O' */ 14, 81 | /* 'P' */ 15, /* 'Q' */ 16, /* 'R' */ 17, /* 'S' */ 18, 82 | /* 'T' */ 19, /* 'U' */ 20, /* 'V' */ 21, /* 'W' */ 22, 83 | /* 'X' */ 23, /* 'Y' */ 24, /* 'Z' */ 25, /* '[' */ -3, 84 | /* '\' */ -3, /* ']' */ -3, /* '^' */ -3, /* '_' */ -3, 85 | /* '`' */ -3, /* 'a' */ 26, /* 'b' */ 27, /* 'c' */ 28, 86 | /* 'd' */ 29, /* 'e' */ 30, /* 'f' */ 31, /* 'g' */ 32, 87 | /* 'h' */ 33, /* 'i' */ 34, /* 'j' */ 35, /* 'k' */ 36, 88 | /* 'l' */ 37, /* 'm' */ 38, /* 'n' */ 39, /* 'o' */ 40, 89 | /* 'p' */ 41, /* 'q' */ 42, /* 'r' */ 43, /* 's' */ 44, 90 | /* 't' */ 45, /* 'u' */ 46, /* 'v' */ 47, /* 'w' */ 48, 91 | /* 'x' */ 49, /* 'y' */ 50, /* 'z' */ 51, /* '{' */ -3, 92 | /* '|' */ -3, /* '}' */ -3, /* '~' */ -3, /* 0x7f */ -3 93 | }; 94 | 95 | const u_int8_t kBits_00000011 = 0x03; 96 | const u_int8_t kBits_00001111 = 0x0F; 97 | const u_int8_t kBits_00110000 = 0x30; 98 | const u_int8_t kBits_00111100 = 0x3C; 99 | const u_int8_t kBits_00111111 = 0x3F; 100 | const u_int8_t kBits_11000000 = 0xC0; 101 | const u_int8_t kBits_11110000 = 0xF0; 102 | const u_int8_t kBits_11111100 = 0xFC; 103 | 104 | size_t EstimateBas64EncodedDataSize(size_t inDataSize) 105 | { 106 | size_t theEncodedDataSize = (int)ceil(inDataSize / 3.0) * 4; 107 | theEncodedDataSize = theEncodedDataSize / 72 * 74 + theEncodedDataSize % 72; 108 | return(theEncodedDataSize); 109 | } 110 | 111 | size_t EstimateBas64DecodedDataSize(size_t inDataSize) 112 | { 113 | size_t theDecodedDataSize = (int)ceil(inDataSize / 4.0) * 3; 114 | //theDecodedDataSize = theDecodedDataSize / 72 * 74 + theDecodedDataSize % 72; 115 | return(theDecodedDataSize); 116 | } 117 | 118 | bool Base64EncodeData(const void *inInputData, size_t inInputDataSize, char *outOutputData, size_t *ioOutputDataSize) 119 | { 120 | size_t theEncodedDataSize = EstimateBas64EncodedDataSize(inInputDataSize); 121 | if (*ioOutputDataSize < theEncodedDataSize) 122 | return(false); 123 | *ioOutputDataSize = theEncodedDataSize; 124 | const u_int8_t *theInPtr = (const u_int8_t *)inInputData; 125 | u_int32_t theInIndex = 0, theOutIndex = 0; 126 | for (; theInIndex < (inInputDataSize / 3) * 3; theInIndex += 3) 127 | { 128 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex] & kBits_11111100) >> 2]; 129 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex] & kBits_00000011) << 4 | (theInPtr[theInIndex + 1] & kBits_11110000) >> 4]; 130 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex + 1] & kBits_00001111) << 2 | (theInPtr[theInIndex + 2] & kBits_11000000) >> 6]; 131 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex + 2] & kBits_00111111) >> 0]; 132 | if (theOutIndex % 74 == 72) 133 | { 134 | outOutputData[theOutIndex++] = '\r'; 135 | outOutputData[theOutIndex++] = '\n'; 136 | } 137 | } 138 | const size_t theRemainingBytes = inInputDataSize - theInIndex; 139 | if (theRemainingBytes == 1) 140 | { 141 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex] & kBits_11111100) >> 2]; 142 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex] & kBits_00000011) << 4 | (0 & kBits_11110000) >> 4]; 143 | outOutputData[theOutIndex++] = '='; 144 | outOutputData[theOutIndex++] = '='; 145 | if (theOutIndex % 74 == 72) 146 | { 147 | outOutputData[theOutIndex++] = '\r'; 148 | #ifdef __clang_analyzer__ 149 | outOutputData[theOutIndex] = '\n'; 150 | #else 151 | outOutputData[theOutIndex++] = '\n'; 152 | #endif 153 | } 154 | } 155 | else if (theRemainingBytes == 2) 156 | { 157 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex] & kBits_11111100) >> 2]; 158 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex] & kBits_00000011) << 4 | (theInPtr[theInIndex + 1] & kBits_11110000) >> 4]; 159 | outOutputData[theOutIndex++] = kBase64EncodeTable[(theInPtr[theInIndex + 1] & kBits_00001111) << 2 | (0 & kBits_11000000) >> 6]; 160 | outOutputData[theOutIndex++] = '='; 161 | if (theOutIndex % 74 == 72) 162 | { 163 | outOutputData[theOutIndex++] = '\r'; 164 | #ifdef __clang_analyzer__ 165 | outOutputData[theOutIndex] = '\n'; 166 | #else 167 | outOutputData[theOutIndex++] = '\n'; 168 | #endif 169 | } 170 | } 171 | return(true); 172 | } 173 | 174 | bool Base64DecodeData(const void *inInputData, size_t inInputDataSize, void *ioOutputData, size_t *ioOutputDataSize) 175 | { 176 | memset(ioOutputData, '.', *ioOutputDataSize); 177 | 178 | size_t theDecodedDataSize = EstimateBas64DecodedDataSize(inInputDataSize); 179 | if (*ioOutputDataSize < theDecodedDataSize) 180 | return(false); 181 | *ioOutputDataSize = 0; 182 | const u_int8_t *theInPtr = (const u_int8_t *)inInputData; 183 | u_int8_t *theOutPtr = (u_int8_t *)ioOutputData; 184 | size_t theInIndex = 0, theOutIndex = 0; 185 | u_int8_t theOutputOctet; 186 | size_t theSequence = 0; 187 | for (; theInIndex < inInputDataSize; ) 188 | { 189 | int8_t theSextet = 0; 190 | 191 | int8_t theCurrentInputOctet = theInPtr[theInIndex]; 192 | theSextet = kBase64DecodeTable[theCurrentInputOctet]; 193 | if (theSextet == -1) 194 | break; 195 | while (theSextet == -2) 196 | { 197 | theCurrentInputOctet = theInPtr[++theInIndex]; 198 | theSextet = kBase64DecodeTable[theCurrentInputOctet]; 199 | } 200 | while (theSextet == -3) 201 | { 202 | theCurrentInputOctet = theInPtr[++theInIndex]; 203 | theSextet = kBase64DecodeTable[theCurrentInputOctet]; 204 | } 205 | if (theSequence == 0) 206 | { 207 | theOutputOctet = (theSextet >= 0 ? theSextet : 0) << 2 & kBits_11111100; 208 | } 209 | else if (theSequence == 1) 210 | { 211 | theOutputOctet |= (theSextet >- 0 ? theSextet : 0) >> 4 & kBits_00000011; 212 | theOutPtr[theOutIndex++] = theOutputOctet; 213 | } 214 | else if (theSequence == 2) 215 | { 216 | theOutputOctet = (theSextet >= 0 ? theSextet : 0) << 4 & kBits_11110000; 217 | } 218 | else if (theSequence == 3) 219 | { 220 | theOutputOctet |= (theSextet >= 0 ? theSextet : 0) >> 2 & kBits_00001111; 221 | theOutPtr[theOutIndex++] = theOutputOctet; 222 | } 223 | else if (theSequence == 4) 224 | { 225 | theOutputOctet = (theSextet >= 0 ? theSextet : 0) << 6 & kBits_11000000; 226 | } 227 | else if (theSequence == 5) 228 | { 229 | theOutputOctet |= (theSextet >= 0 ? theSextet : 0) >> 0 & kBits_00111111; 230 | theOutPtr[theOutIndex++] = theOutputOctet; 231 | } 232 | theSequence = (theSequence + 1) % 6; 233 | if (theSequence != 2 && theSequence != 4) 234 | theInIndex++; 235 | } 236 | *ioOutputDataSize = theOutIndex; 237 | return(true); 238 | } 239 | -------------------------------------------------------------------------------- /SSOAuthKit/Vendor/OAuthConsumer/Base64Transcoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Base64Transcoder.h 3 | * Base64Test 4 | * 5 | * Created by Jonathan Wight on Tue Mar 18 2003. 6 | * Copyright (c) 2003 Toxic Software. All rights reserved. 7 | * 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy 9 | * of this software and associated documentation files (the "Software"), to deal 10 | * in the Software without restriction, including without limitation the rights 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | * copies of the Software, and to permit persons to whom the Software is 13 | * furnished to do so, subject to the following conditions: 14 | * 15 | * The above copyright notice and this permission notice shall be included in 16 | * all copies or substantial portions of the Software. 17 | * 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | * THE SOFTWARE. 25 | * 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | extern size_t EstimateBas64EncodedDataSize(size_t inDataSize); 32 | extern size_t EstimateBas64DecodedDataSize(size_t inDataSize); 33 | 34 | extern bool Base64EncodeData(const void *inInputData, size_t inInputDataSize, char *outOutputData, size_t *ioOutputDataSize); 35 | extern bool Base64DecodeData(const void *inInputData, size_t inInputDataSize, void *ioOutputData, size_t *ioOutputDataSize); 36 | 37 | -------------------------------------------------------------------------------- /SSOAuthKit/Vendor/OAuthConsumer/OAHMAC_SHA1SignatureProvider.h: -------------------------------------------------------------------------------- 1 | // 2 | // OAHMAC_SHA1SignatureProvider.h 3 | // OAuthConsumer 4 | // 5 | // Created by Jon Crosby on 10/19/07. 6 | // Copyright 2007 Kaboomerang LLC. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "OASignatureProviding.h" 27 | 28 | @interface OAHMAC_SHA1SignatureProvider : NSObject 29 | @end 30 | -------------------------------------------------------------------------------- /SSOAuthKit/Vendor/OAuthConsumer/OAHMAC_SHA1SignatureProvider.m: -------------------------------------------------------------------------------- 1 | // 2 | // OAHMAC_SHA1SignatureProvider.m 3 | // OAuthConsumer 4 | // 5 | // Created by Jon Crosby on 10/19/07. 6 | // Copyright 2007 Kaboomerang LLC. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | #import "OAHMAC_SHA1SignatureProvider.h" 27 | #import 28 | #include "Base64Transcoder.h" 29 | 30 | @implementation OAHMAC_SHA1SignatureProvider 31 | 32 | - (NSString *)name { 33 | return @"HMAC-SHA1"; 34 | } 35 | 36 | 37 | - (NSString *)signClearText:(NSString *)text withSecret:(NSString *)secret { 38 | NSData *secretData = [secret dataUsingEncoding:NSUTF8StringEncoding]; 39 | NSData *clearTextData = [text dataUsingEncoding:NSUTF8StringEncoding]; 40 | 41 | uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0}; 42 | 43 | CCHmacContext hmacContext; 44 | CCHmacInit(&hmacContext, kCCHmacAlgSHA1, secretData.bytes, secretData.length); 45 | CCHmacUpdate(&hmacContext, clearTextData.bytes, clearTextData.length); 46 | CCHmacFinal(&hmacContext, digest); 47 | 48 | // Base64 Encoding 49 | char base64Result[32]; 50 | size_t theResultLength = 32; 51 | Base64EncodeData(digest, CC_SHA1_DIGEST_LENGTH, base64Result, &theResultLength); 52 | NSData *theData = [NSData dataWithBytes:base64Result length:theResultLength]; 53 | 54 | NSString *base64EncodedResult = [[NSString alloc] initWithData:theData encoding:NSUTF8StringEncoding]; 55 | 56 | return [base64EncodedResult autorelease]; 57 | } 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /SSOAuthKit/Vendor/OAuthConsumer/OASignatureProviding.h: -------------------------------------------------------------------------------- 1 | // 2 | // OASignatureProviding.h 3 | // 4 | // Created by Jon Crosby on 10/19/07. 5 | // Copyright 2007 Kaboomerang LLC. All rights reserved. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | 25 | @protocol OASignatureProviding 26 | 27 | - (NSString *)name; 28 | - (NSString *)signClearText:(NSString *)text withSecret:(NSString *)secret; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /TwitterDemo/Classes/TwitterDemoAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // TwitterDemoAppDelegate.h 3 | // TwitterDemo 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright Sam Soffes 2010-2011. All rights reserved. 7 | // 8 | 9 | @interface TwitterDemoAppDelegate : NSObject { 10 | 11 | @private 12 | 13 | UIWindow *_window; 14 | } 15 | 16 | @property (nonatomic, retain) UIWindow *window; 17 | 18 | @end 19 | 20 | -------------------------------------------------------------------------------- /TwitterDemo/Classes/TwitterDemoAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // TwitterDemoAppDelegate.m 3 | // TwitterDemo 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright Sam Soffes 2010-2011. All rights reserved. 7 | // 8 | 9 | #import "TwitterDemoAppDelegate.h" 10 | #import "TwitterDemoViewController.h" 11 | 12 | @implementation TwitterDemoAppDelegate 13 | 14 | @synthesize window = _window; 15 | 16 | #pragma mark - 17 | #pragma mark NSObject 18 | 19 | - (void)dealloc { 20 | [_window release]; 21 | [super dealloc]; 22 | } 23 | 24 | 25 | #pragma mark - 26 | #pragma mark UIApplicationDelegate 27 | 28 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 29 | _window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 30 | 31 | TwitterDemoViewController *viewController = [[TwitterDemoViewController alloc] init]; 32 | _window.rootViewController = viewController; 33 | [viewController release]; 34 | 35 | [_window makeKeyAndVisible]; 36 | 37 | return YES; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /TwitterDemo/Classes/TwitterDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TwitterDemoViewController.h 3 | // TwitterDemo 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright Sam Soffes 2010-2011. All rights reserved. 7 | // 8 | 9 | #import "SSTwitterAuthViewControllerDelegate.h" 10 | 11 | @interface TwitterDemoViewController : UIViewController { 12 | 13 | @private 14 | 15 | UILabel *_userLabel; 16 | } 17 | 18 | - (void)loginWithOAuth:(id)sender; 19 | - (void)loginWithXAuth:(id)sender; 20 | 21 | @end 22 | 23 | -------------------------------------------------------------------------------- /TwitterDemo/Classes/TwitterDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TwitterDemoViewController.m 3 | // TwitterDemo 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright Sam Soffes 2010-2011. All rights reserved. 7 | // 8 | 9 | #import "TwitterDemoViewController.h" 10 | #import 11 | 12 | @implementation TwitterDemoViewController 13 | 14 | #pragma mark - 15 | #pragma mark NSObject 16 | 17 | - (void)dealloc { 18 | [_userLabel release]; 19 | [super dealloc]; 20 | } 21 | 22 | 23 | #pragma mark - 24 | #pragma mark UIViewController 25 | 26 | - (void)viewDidLoad { 27 | #error Please set your consumer key and secret below and remove this line 28 | [SSOAuthKitConfiguration setConsumerKey:@"COMSUMER_KEY" secret:@"COMSUMER_SECRET"]; 29 | 30 | self.view.backgroundColor = [UIColor whiteColor]; 31 | 32 | // Login with OAuth button 33 | UIButton *oAuthButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 34 | oAuthButton.frame = CGRectMake(20.0, 20.0, 280.0, 44.0); 35 | [oAuthButton setTitle:@"Login with OAuth" forState:UIControlStateNormal]; 36 | [oAuthButton addTarget:self action:@selector(loginWithOAuth:) forControlEvents:UIControlEventTouchUpInside]; 37 | [self.view addSubview:oAuthButton]; 38 | 39 | // Login with xAuth button 40 | UIButton *xAuthButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 41 | xAuthButton.frame = CGRectMake(20.0, 84.0, 280.0, 44.0); 42 | [xAuthButton setTitle:@"Login with xAuth" forState:UIControlStateNormal]; 43 | [xAuthButton addTarget:self action:@selector(loginWithXAuth:) forControlEvents:UIControlEventTouchUpInside]; 44 | [self.view addSubview:xAuthButton]; 45 | 46 | // User label 47 | _userLabel = [[UILabel alloc] initWithFrame:CGRectMake(20.0, 148.0, 280.0, 20.0)]; 48 | [self.view addSubview:_userLabel]; 49 | } 50 | 51 | 52 | #pragma mark - 53 | #pragma mark Actions 54 | 55 | - (void)loginWithOAuth:(id)sender { 56 | SSTwitterOAuthViewController *viewController = [[SSTwitterOAuthViewController alloc] initWithDelegate:self]; 57 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 58 | navigationController.modalPresentationStyle = UIModalPresentationFormSheet; 59 | [self presentModalViewController:navigationController animated:YES]; 60 | [viewController release]; 61 | [navigationController release]; 62 | } 63 | 64 | 65 | - (void)loginWithXAuth:(id)sender { 66 | SSTwitterXAuthViewController *viewController = [[SSTwitterXAuthViewController alloc] initWithDelegate:self]; 67 | UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; 68 | navigationController.modalPresentationStyle = UIModalPresentationFormSheet; 69 | [self presentModalViewController:navigationController animated:YES]; 70 | [viewController release]; 71 | [navigationController release]; 72 | } 73 | 74 | 75 | #pragma mark - 76 | #pragma mark SSTwitterOAuthViewControllerDelegate 77 | 78 | - (void)twitterAuthViewControllerDidCancel:(UIViewController *)viewController { 79 | NSLog(@"Canceled"); 80 | [self dismissModalViewControllerAnimated:YES]; 81 | } 82 | 83 | 84 | - (void)twitterAuthViewController:(UIViewController *)viewController didFailWithError:(NSError *)error { 85 | NSLog(@"Failed with error: %@", error); 86 | [self dismissModalViewControllerAnimated:YES]; 87 | 88 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 89 | [alert show]; 90 | [alert release]; 91 | } 92 | 93 | 94 | - (void)twitterAuthViewController:(UIViewController *)viewController didAuthorizeWithAccessToken:(SSOAToken *)accessToken userDictionary:(NSDictionary *)userDictionary { 95 | NSLog(@"Finished! %@", userDictionary); 96 | [self dismissModalViewControllerAnimated:YES]; 97 | 98 | _userLabel.text = [NSString stringWithFormat:@"Logged in as @%@", [userDictionary objectForKey:@"screen_name"]]; 99 | } 100 | 101 | @end 102 | -------------------------------------------------------------------------------- /TwitterDemo/TwitterDemo-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | com.samsoffes.ssoauthkit.twitterdemo 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UISupportedInterfaceOrientations 28 | 29 | UIInterfaceOrientationPortrait 30 | UIInterfaceOrientationPortraitUpsideDown 31 | UIInterfaceOrientationLandscapeLeft 32 | UIInterfaceOrientationLandscapeRight 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /TwitterDemo/TwitterDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 45; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1D3623260D0F684500981E51 /* TwitterDemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* TwitterDemoAppDelegate.m */; }; 11 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 12 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 13 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 14 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; 15 | 28D7ACF80DDB3853001CB0EB /* TwitterDemoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* TwitterDemoViewController.m */; }; 16 | B29851BD11F0D856008B1A4A /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B29851BC11F0D856008B1A4A /* CFNetwork.framework */; }; 17 | B29851BF11F0D856008B1A4A /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B29851BE11F0D856008B1A4A /* MobileCoreServices.framework */; }; 18 | B29851C111F0D856008B1A4A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B29851C011F0D856008B1A4A /* SystemConfiguration.framework */; }; 19 | B29851C311F0D856008B1A4A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B29851C211F0D856008B1A4A /* libz.dylib */; }; 20 | B29851CD11F0D85C008B1A4A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B29851CC11F0D85C008B1A4A /* Security.framework */; }; 21 | B2E036D3121DC9D400D02434 /* SSOAuthKit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B2E036D2121DC9D400D02434 /* SSOAuthKit.bundle */; }; 22 | B2E036D7121DC9DF00D02434 /* SSToolkit.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B2E036D6121DC9DF00D02434 /* SSToolkit.bundle */; }; 23 | B2E036F4121DC9F000D02434 /* libSSOAuthKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B2E036F3121DC9EE00D02434 /* libSSOAuthKit.a */; }; 24 | /* End PBXBuildFile section */ 25 | 26 | /* Begin PBXContainerItemProxy section */ 27 | B2E036F2121DC9EE00D02434 /* PBXContainerItemProxy */ = { 28 | isa = PBXContainerItemProxy; 29 | containerPortal = B2E036E1121DC9EE00D02434 /* SSOAuthKit.xcodeproj */; 30 | proxyType = 2; 31 | remoteGlobalIDString = D2AAC07E0554694100DB518D; 32 | remoteInfo = SSOAuthKit; 33 | }; 34 | B2E036F5121DC9F400D02434 /* PBXContainerItemProxy */ = { 35 | isa = PBXContainerItemProxy; 36 | containerPortal = B2E036E1121DC9EE00D02434 /* SSOAuthKit.xcodeproj */; 37 | proxyType = 1; 38 | remoteGlobalIDString = D2AAC07D0554694100DB518D; 39 | remoteInfo = SSOAuthKit; 40 | }; 41 | /* End PBXContainerItemProxy section */ 42 | 43 | /* Begin PBXFileReference section */ 44 | 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 45 | 1D3623240D0F684500981E51 /* TwitterDemoAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwitterDemoAppDelegate.h; sourceTree = ""; }; 46 | 1D3623250D0F684500981E51 /* TwitterDemoAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TwitterDemoAppDelegate.m; sourceTree = ""; }; 47 | 1D6058910D05DD3D006BFB54 /* TwitterDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TwitterDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 49 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 50 | 28D7ACF60DDB3853001CB0EB /* TwitterDemoViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwitterDemoViewController.h; sourceTree = ""; }; 51 | 28D7ACF70DDB3853001CB0EB /* TwitterDemoViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TwitterDemoViewController.m; sourceTree = ""; }; 52 | 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 53 | 32CA4F630368D1EE00C91783 /* TwitterDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TwitterDemo_Prefix.pch; sourceTree = ""; }; 54 | 8D1107310486CEB800E47090 /* TwitterDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TwitterDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; 55 | B29851BC11F0D856008B1A4A /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 56 | B29851BE11F0D856008B1A4A /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; 57 | B29851C011F0D856008B1A4A /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 58 | B29851C211F0D856008B1A4A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 59 | B29851CC11F0D85C008B1A4A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 60 | B2E036D2121DC9D400D02434 /* SSOAuthKit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SSOAuthKit.bundle; path = ../Resources/SSOAuthKit.bundle; sourceTree = SOURCE_ROOT; }; 61 | B2E036D6121DC9DF00D02434 /* SSToolkit.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; name = SSToolkit.bundle; path = ../SSOAuthKit/Vendor/SSToolkit/Resources/SSToolkit.bundle; sourceTree = SOURCE_ROOT; }; 62 | B2E036E1121DC9EE00D02434 /* SSOAuthKit.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SSOAuthKit.xcodeproj; path = ../SSOAuthKit.xcodeproj; sourceTree = SOURCE_ROOT; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 71 | 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 72 | 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, 73 | B29851BD11F0D856008B1A4A /* CFNetwork.framework in Frameworks */, 74 | B29851BF11F0D856008B1A4A /* MobileCoreServices.framework in Frameworks */, 75 | B29851C111F0D856008B1A4A /* SystemConfiguration.framework in Frameworks */, 76 | B29851C311F0D856008B1A4A /* libz.dylib in Frameworks */, 77 | B29851CD11F0D85C008B1A4A /* Security.framework in Frameworks */, 78 | B2E036F4121DC9F000D02434 /* libSSOAuthKit.a in Frameworks */, 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | 080E96DDFE201D6D7F000001 /* Classes */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 1D3623240D0F684500981E51 /* TwitterDemoAppDelegate.h */, 89 | 1D3623250D0F684500981E51 /* TwitterDemoAppDelegate.m */, 90 | 28D7ACF60DDB3853001CB0EB /* TwitterDemoViewController.h */, 91 | 28D7ACF70DDB3853001CB0EB /* TwitterDemoViewController.m */, 92 | ); 93 | path = Classes; 94 | sourceTree = ""; 95 | }; 96 | 19C28FACFE9D520D11CA2CBB /* Products */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 1D6058910D05DD3D006BFB54 /* TwitterDemo.app */, 100 | ); 101 | name = Products; 102 | sourceTree = ""; 103 | }; 104 | 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 080E96DDFE201D6D7F000001 /* Classes */, 108 | 29B97315FDCFA39411CA2CEA /* Other Sources */, 109 | 29B97317FDCFA39411CA2CEA /* Resources */, 110 | 29B97323FDCFA39411CA2CEA /* Frameworks */, 111 | 19C28FACFE9D520D11CA2CBB /* Products */, 112 | ); 113 | name = CustomTemplate; 114 | sourceTree = ""; 115 | }; 116 | 29B97315FDCFA39411CA2CEA /* Other Sources */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 32CA4F630368D1EE00C91783 /* TwitterDemo_Prefix.pch */, 120 | 29B97316FDCFA39411CA2CEA /* main.m */, 121 | ); 122 | name = "Other Sources"; 123 | sourceTree = ""; 124 | }; 125 | 29B97317FDCFA39411CA2CEA /* Resources */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 8D1107310486CEB800E47090 /* TwitterDemo-Info.plist */, 129 | B2E036D2121DC9D400D02434 /* SSOAuthKit.bundle */, 130 | B2E036D6121DC9DF00D02434 /* SSToolkit.bundle */, 131 | ); 132 | name = Resources; 133 | sourceTree = ""; 134 | }; 135 | 29B97323FDCFA39411CA2CEA /* Frameworks */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | B2E036E1121DC9EE00D02434 /* SSOAuthKit.xcodeproj */, 139 | 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, 140 | 1D30AB110D05D00D00671497 /* Foundation.framework */, 141 | 288765A40DF7441C002DB57D /* CoreGraphics.framework */, 142 | B29851BC11F0D856008B1A4A /* CFNetwork.framework */, 143 | B29851BE11F0D856008B1A4A /* MobileCoreServices.framework */, 144 | B29851C011F0D856008B1A4A /* SystemConfiguration.framework */, 145 | B29851C211F0D856008B1A4A /* libz.dylib */, 146 | B29851CC11F0D85C008B1A4A /* Security.framework */, 147 | ); 148 | name = Frameworks; 149 | sourceTree = ""; 150 | }; 151 | B2E036E2121DC9EE00D02434 /* Products */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | B2E036F3121DC9EE00D02434 /* libSSOAuthKit.a */, 155 | ); 156 | name = Products; 157 | sourceTree = ""; 158 | }; 159 | /* End PBXGroup section */ 160 | 161 | /* Begin PBXNativeTarget section */ 162 | 1D6058900D05DD3D006BFB54 /* TwitterDemo */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "TwitterDemo" */; 165 | buildPhases = ( 166 | 1D60588D0D05DD3D006BFB54 /* Resources */, 167 | 1D60588E0D05DD3D006BFB54 /* Sources */, 168 | 1D60588F0D05DD3D006BFB54 /* Frameworks */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | B2E036F6121DC9F400D02434 /* PBXTargetDependency */, 174 | ); 175 | name = TwitterDemo; 176 | productName = TwitterDemo; 177 | productReference = 1D6058910D05DD3D006BFB54 /* TwitterDemo.app */; 178 | productType = "com.apple.product-type.application"; 179 | }; 180 | /* End PBXNativeTarget section */ 181 | 182 | /* Begin PBXProject section */ 183 | 29B97313FDCFA39411CA2CEA /* Project object */ = { 184 | isa = PBXProject; 185 | attributes = { 186 | ORGANIZATIONNAME = "Sam Soffes"; 187 | }; 188 | buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TwitterDemo" */; 189 | compatibilityVersion = "Xcode 3.1"; 190 | developmentRegion = English; 191 | hasScannedForEncodings = 1; 192 | knownRegions = ( 193 | English, 194 | Japanese, 195 | French, 196 | German, 197 | ); 198 | mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; 199 | projectDirPath = ""; 200 | projectReferences = ( 201 | { 202 | ProductGroup = B2E036E2121DC9EE00D02434 /* Products */; 203 | ProjectRef = B2E036E1121DC9EE00D02434 /* SSOAuthKit.xcodeproj */; 204 | }, 205 | ); 206 | projectRoot = ""; 207 | targets = ( 208 | 1D6058900D05DD3D006BFB54 /* TwitterDemo */, 209 | ); 210 | }; 211 | /* End PBXProject section */ 212 | 213 | /* Begin PBXReferenceProxy section */ 214 | B2E036F3121DC9EE00D02434 /* libSSOAuthKit.a */ = { 215 | isa = PBXReferenceProxy; 216 | fileType = archive.ar; 217 | path = libSSOAuthKit.a; 218 | remoteRef = B2E036F2121DC9EE00D02434 /* PBXContainerItemProxy */; 219 | sourceTree = BUILT_PRODUCTS_DIR; 220 | }; 221 | /* End PBXReferenceProxy section */ 222 | 223 | /* Begin PBXResourcesBuildPhase section */ 224 | 1D60588D0D05DD3D006BFB54 /* Resources */ = { 225 | isa = PBXResourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | B2E036D3121DC9D400D02434 /* SSOAuthKit.bundle in Resources */, 229 | B2E036D7121DC9DF00D02434 /* SSToolkit.bundle in Resources */, 230 | ); 231 | runOnlyForDeploymentPostprocessing = 0; 232 | }; 233 | /* End PBXResourcesBuildPhase section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | 1D60588E0D05DD3D006BFB54 /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | 1D60589B0D05DD56006BFB54 /* main.m in Sources */, 241 | 1D3623260D0F684500981E51 /* TwitterDemoAppDelegate.m in Sources */, 242 | 28D7ACF80DDB3853001CB0EB /* TwitterDemoViewController.m in Sources */, 243 | ); 244 | runOnlyForDeploymentPostprocessing = 0; 245 | }; 246 | /* End PBXSourcesBuildPhase section */ 247 | 248 | /* Begin PBXTargetDependency section */ 249 | B2E036F6121DC9F400D02434 /* PBXTargetDependency */ = { 250 | isa = PBXTargetDependency; 251 | name = SSOAuthKit; 252 | targetProxy = B2E036F5121DC9F400D02434 /* PBXContainerItemProxy */; 253 | }; 254 | /* End PBXTargetDependency section */ 255 | 256 | /* Begin XCBuildConfiguration section */ 257 | 1D6058940D05DD3E006BFB54 /* Debug */ = { 258 | isa = XCBuildConfiguration; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | COPY_PHASE_STRIP = NO; 262 | GCC_DYNAMIC_NO_PIC = NO; 263 | GCC_OPTIMIZATION_LEVEL = 0; 264 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 265 | GCC_PREFIX_HEADER = TwitterDemo_Prefix.pch; 266 | HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../\"/**"; 267 | INFOPLIST_FILE = "TwitterDemo-Info.plist"; 268 | OTHER_LDFLAGS = ( 269 | "-ObjC", 270 | "-all_load", 271 | ); 272 | PRODUCT_NAME = TwitterDemo; 273 | SDKROOT = iphoneos; 274 | TARGETED_DEVICE_FAMILY = "1,2"; 275 | }; 276 | name = Debug; 277 | }; 278 | 1D6058950D05DD3E006BFB54 /* Release */ = { 279 | isa = XCBuildConfiguration; 280 | buildSettings = { 281 | ALWAYS_SEARCH_USER_PATHS = NO; 282 | COPY_PHASE_STRIP = YES; 283 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 284 | GCC_PREFIX_HEADER = TwitterDemo_Prefix.pch; 285 | HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../\"/**"; 286 | INFOPLIST_FILE = "TwitterDemo-Info.plist"; 287 | OTHER_LDFLAGS = ( 288 | "-ObjC", 289 | "-all_load", 290 | ); 291 | PRODUCT_NAME = TwitterDemo; 292 | SDKROOT = iphoneos; 293 | TARGETED_DEVICE_FAMILY = "1,2"; 294 | VALIDATE_PRODUCT = YES; 295 | }; 296 | name = Release; 297 | }; 298 | C01FCF4F08A954540054247B /* Debug */ = { 299 | isa = XCBuildConfiguration; 300 | buildSettings = { 301 | ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; 302 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 303 | GCC_C_LANGUAGE_STANDARD = c99; 304 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 305 | GCC_WARN_UNUSED_VARIABLE = YES; 306 | PREBINDING = NO; 307 | SDKROOT = iphoneos3.2; 308 | TARGETED_DEVICE_FAMILY = 2; 309 | }; 310 | name = Debug; 311 | }; 312 | C01FCF5008A954540054247B /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; 316 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 317 | GCC_C_LANGUAGE_STANDARD = c99; 318 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 319 | GCC_WARN_UNUSED_VARIABLE = YES; 320 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 321 | PREBINDING = NO; 322 | SDKROOT = iphoneos3.2; 323 | TARGETED_DEVICE_FAMILY = 2; 324 | }; 325 | name = Release; 326 | }; 327 | /* End XCBuildConfiguration section */ 328 | 329 | /* Begin XCConfigurationList section */ 330 | 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "TwitterDemo" */ = { 331 | isa = XCConfigurationList; 332 | buildConfigurations = ( 333 | 1D6058940D05DD3E006BFB54 /* Debug */, 334 | 1D6058950D05DD3E006BFB54 /* Release */, 335 | ); 336 | defaultConfigurationIsVisible = 0; 337 | defaultConfigurationName = Release; 338 | }; 339 | C01FCF4E08A954540054247B /* Build configuration list for PBXProject "TwitterDemo" */ = { 340 | isa = XCConfigurationList; 341 | buildConfigurations = ( 342 | C01FCF4F08A954540054247B /* Debug */, 343 | C01FCF5008A954540054247B /* Release */, 344 | ); 345 | defaultConfigurationIsVisible = 0; 346 | defaultConfigurationName = Release; 347 | }; 348 | /* End XCConfigurationList section */ 349 | }; 350 | rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; 351 | } 352 | -------------------------------------------------------------------------------- /TwitterDemo/TwitterDemo_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'TwitterDemo' target in the 'TwitterDemo' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import 8 | #endif 9 | -------------------------------------------------------------------------------- /TwitterDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // TwitterDemo 4 | // 5 | // Created by Sam Soffes on 7/16/10. 6 | // Copyright Sam Soffes 2010-2011. All rights reserved. 7 | // 8 | 9 | int main(int argc, char *argv[]) { 10 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 11 | int retVal = UIApplicationMain(argc, argv, nil, @"TwitterDemoAppDelegate"); 12 | [pool release]; 13 | return retVal; 14 | } 15 | --------------------------------------------------------------------------------