-
Notifications
You must be signed in to change notification settings - Fork 481
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from firebase/demm-auth
[0.3 RC] Adding Authentication to FirebaseUI
- Loading branch information
Showing
63 changed files
with
2,969 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "FirebaseUI" | ||
s.version = "0.2.6" | ||
s.version = "0.3.0" | ||
s.summary = "UI binding libraries for Firebase." | ||
s.homepage = "https://github.com/firebase/FirebaseUI-iOS" | ||
s.license = { :type => 'MIT', :file => 'LICENSE' } | ||
s.author = { "Firebase" => "[email protected]" } | ||
s.social_media_url = "https://twitter.com/firebase" | ||
s.source = { :git => "https://github.com/firebase/FirebaseUI-iOS.git", :tag => 'v0.2.6' } | ||
s.source = { :git => "https://github.com/firebase/FirebaseUI-iOS.git", :tag => 'v0.3.0' } | ||
s.source_files = "FirebaseUI/**/*.{h,m}" | ||
s.dependency "Firebase", "~> 2.4.1.1" | ||
s.resources = "FirebaseUI/**/Resources/*" | ||
s.dependency "Firebase", "~>2.2" | ||
s.dependency "FBSDKCoreKit" | ||
s.dependency "FBSDKLoginKit" | ||
s.dependency "Google/SignIn" | ||
s.platform = :ios | ||
s.ios.deployment_target = "8.0" | ||
s.ios.framework = "UIKit" | ||
s.ios.framework = "UIKit", "Accounts" | ||
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/Firebase"' } | ||
s.requires_arc = true | ||
end |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// clang-format off | ||
|
||
/* | ||
* Firebase UI Bindings iOS Library | ||
* | ||
* Copyright © 2015 Firebase - All Rights Reserved | ||
* https://www.firebase.com | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binaryform must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#import <Firebase/Firebase.h> | ||
|
||
#if LOCAL_BUILD | ||
#import <GoogleSignIn/GoogleSignIn.h> | ||
#import "GGLContext.h" | ||
#else | ||
#import <Google/SignIn.h> | ||
#endif | ||
|
||
#import <FBSDKCoreKit/FBSDKCoreKit.h> | ||
#import <FBSDKLoginKit/FBSDKLoginKit.h> | ||
|
||
/** | ||
* A replacement for the AppDelegate which includes setup for the Google and Facebook SDK's | ||
* Implements -application:didFinishLaunchingWithOptions: and -application:openURL:sourceApplication:annotation: | ||
* so make sure to call the appropriate superclass methods if you override those in a concrete implementation. | ||
*/ | ||
@interface FirebaseAppDelegate : UIResponder<UIApplicationDelegate> | ||
|
||
@property (strong, nonatomic) UIWindow *window; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// clang-format off | ||
|
||
/* | ||
* Firebase UI Bindings iOS Library | ||
* | ||
* Copyright © 2015 Firebase - All Rights Reserved | ||
* https://www.firebase.com | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binaryform must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
// clang-format on | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <CoreGraphics/CGBase.h> | ||
|
||
#ifndef FirebaseAuthConstants_h | ||
#define FirebaseAuthConstants_h | ||
|
||
FOUNDATION_EXPORT NSString *const kFWPRequestType; | ||
|
||
FOUNDATION_EXPORT NSString *const kTwitterAuthProvider; | ||
FOUNDATION_EXPORT NSString *const kTwitterApiKey; | ||
|
||
FOUNDATION_EXPORT NSString *const kFacebookAuthProvider; | ||
FOUNDATION_EXPORT NSString *const kFacebookAppId; | ||
FOUNDATION_EXPORT NSString *const kFacebookDisplayName; | ||
FOUNDATION_EXPORT NSString *const kFacebookEmailScope; | ||
|
||
FOUNDATION_EXPORT NSString *const kGoogleAuthProvider; | ||
|
||
FOUNDATION_EXPORT NSString *const kPasswordAuthProvider; | ||
|
||
FOUNDATION_EXPORT CGFloat const kHeaderWidth; | ||
FOUNDATION_EXPORT CGFloat const kHeaderHeight; | ||
FOUNDATION_EXPORT CGFloat const kHeaderSpace; | ||
|
||
FOUNDATION_EXPORT CGFloat const kTextFieldWidth; | ||
FOUNDATION_EXPORT CGFloat const kTextFieldHeight; | ||
FOUNDATION_EXPORT CGFloat const kTextFieldSpace; | ||
|
||
FOUNDATION_EXPORT CGFloat const kButtonWidth; | ||
FOUNDATION_EXPORT CGFloat const kButtonHeight; | ||
FOUNDATION_EXPORT CGFloat const kButtonSpace; | ||
|
||
FOUNDATION_EXPORT CGFloat const kSeparatorWidth; | ||
FOUNDATION_EXPORT CGFloat const kSeparatorHeight; | ||
FOUNDATION_EXPORT CGFloat const kSeparatorSpace; | ||
|
||
#endif /* FirebaseAuthConstants_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// clang-format off | ||
|
||
/* | ||
* Firebase UI Bindings iOS Library | ||
* | ||
* Copyright © 2015 Firebase - All Rights Reserved | ||
* https://www.firebase.com | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binaryform must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
// clang-format on | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#import <Firebase/Firebase.h> | ||
|
||
#import "FirebaseAuthDelegate.h" | ||
#import "FirebaseAuthConstants.h" | ||
|
||
/** | ||
* The base auth provider class that authenticates a user with an identity provider | ||
* to a Firebase reference. Subclass this to add support for new identity providers. | ||
*/ | ||
@interface FirebaseAuthProvider : NSObject | ||
|
||
/** | ||
* The Firebase reference to authenticate against | ||
*/ | ||
@property(strong, nonatomic) Firebase *ref; | ||
|
||
/** | ||
* The Firebase authentication data for the currently authenticated user | ||
*/ | ||
@property(strong, nonatomic) FAuthData *authData; | ||
|
||
/** | ||
* A string which represents the chosen authentication provider. | ||
* See FAuthenticationConstants.h for a full list. | ||
*/ | ||
@property(strong, nonatomic) NSString *provider; | ||
|
||
/** | ||
* FirebaseAuthDelegate delegate to handle all login, logout, and error events | ||
* from both authentication providers and Firebase | ||
*/ | ||
@property(weak, nonatomic) id<FirebaseAuthDelegate> delegate; | ||
|
||
/** | ||
* Create an instance of FirebaseAuthProvider, which allows for simple authentication to Firebase | ||
* via various identity providers (social, email/password, etc.). This method should be called | ||
* by subclasses | ||
* @param ref The Firebase reference to use for authentication | ||
* @param authDelegate A class that implements the FirebaseAuthDelegate protocol | ||
* @return FirebaseAuthProvider | ||
*/ | ||
- (instancetype)initWithRef:(Firebase *)ref authDelegate:(id<FirebaseAuthDelegate>)authDelegate; | ||
|
||
/** | ||
* Log in to the selected authentication provider. | ||
* Note: you must override this method, as the default implementation raises an exception. | ||
* @return void | ||
*/ | ||
- (void)login; | ||
|
||
/** | ||
* Logout of the currently authenticated provider | ||
* Note: Always call [super logout] in subclass overrides | ||
* @return void | ||
*/ | ||
- (void)logout; | ||
|
||
/** | ||
* Configure the current authentication provider (for instance, by retrieving keys, testing URL | ||
* schemes, etc.) | ||
* Note: you must override this method, as the default implementation raises an exception. | ||
* @return void | ||
*/ | ||
- (void)configureProvider; | ||
|
||
- (void)handleError:(NSError *)error; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// clang-format off | ||
|
||
/* | ||
* Firebase UI Bindings iOS Library | ||
* | ||
* Copyright © 2015 Firebase - All Rights Reserved | ||
* https://www.firebase.com | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binaryform must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
// clang-format on | ||
|
||
#import <Firebase/Firebase.h> | ||
|
||
#import <FBSDKCoreKit/FBSDKCoreKit.h> | ||
#import <FBSDKLoginKit/FBSDKLoginKit.h> | ||
|
||
#import "FirebaseAuthProvider.h" | ||
|
||
/** | ||
* An authentication provider class that authenticates a user with Facebook | ||
* and uses the credentials to authenticate a Firebase reference | ||
*/ | ||
@interface FirebaseFacebookAuthProvider : FirebaseAuthProvider | ||
|
||
/** | ||
* A Facebook Login Manager object for handling Facebook authentication | ||
*/ | ||
@property(strong, nonatomic) FBSDKLoginManager *loginManager; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// clang-format off | ||
|
||
/* | ||
* Firebase UI Bindings iOS Library | ||
* | ||
* Copyright © 2015 Firebase - All Rights Reserved | ||
* https://www.firebase.com | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binaryform must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR | ||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT, | ||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | ||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
// clang-format on | ||
|
||
#import <Firebase/Firebase.h> | ||
|
||
#if LOCAL_BUILD | ||
#import <GoogleSignIn/GoogleSignIn.h> | ||
#else | ||
#import <Google/SignIn.h> | ||
#endif | ||
|
||
#import "FirebaseAuthProvider.h" | ||
|
||
/** | ||
* An authentication provider class that authenticates a user with Google | ||
* and uses the credentials to authenticate a Firebase reference | ||
*/ | ||
@interface FirebaseGoogleAuthProvider : FirebaseAuthProvider<GIDSignInDelegate, GIDSignInUIDelegate> | ||
|
||
/** | ||
* Create an instance of FirebaseGoogleAuthProvider, which allows for simple authentication to | ||
* Firebase via Gooogle | ||
* @param ref The Firebase reference to use for authentication | ||
* @param authDelegate A class that implements the FirebaseAuthDelegate protocol | ||
* @param uiDelegate A UIViewController subclass that implements the GIDSignInUIDelegate protocol | ||
* @return FirebaseGoogleAuthProvider | ||
*/ | ||
- (instancetype)initWithRef:(Firebase *)ref | ||
authDelegate:(id<FirebaseAuthDelegate>)authDelegate | ||
uiDelegate:(UIViewController<GIDSignInUIDelegate> *)uiDelegate; | ||
|
||
@end |
Oops, something went wrong.