Skip to content

Commit 5e00751

Browse files
committed
Merge pull request #21 from firebase/demm-auth
[0.3 RC] Adding Authentication to FirebaseUI
2 parents 1756aa3 + 09ea628 commit 5e00751

File tree

63 files changed

+2969
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2969
-168
lines changed

FirebaseUI.podspec

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
Pod::Spec.new do |s|
22
s.name = "FirebaseUI"
3-
s.version = "0.2.6"
3+
s.version = "0.3.0"
44
s.summary = "UI binding libraries for Firebase."
55
s.homepage = "https://github.com/firebase/FirebaseUI-iOS"
66
s.license = { :type => 'MIT', :file => 'LICENSE' }
77
s.author = { "Firebase" => "[email protected]" }
88
s.social_media_url = "https://twitter.com/firebase"
9-
s.source = { :git => "https://github.com/firebase/FirebaseUI-iOS.git", :tag => 'v0.2.6' }
9+
s.source = { :git => "https://github.com/firebase/FirebaseUI-iOS.git", :tag => 'v0.3.0' }
1010
s.source_files = "FirebaseUI/**/*.{h,m}"
11-
s.dependency "Firebase", "~> 2.4.1.1"
11+
s.resources = "FirebaseUI/**/Resources/*"
12+
s.dependency "Firebase", "~>2.2"
13+
s.dependency "FBSDKCoreKit"
14+
s.dependency "FBSDKLoginKit"
15+
s.dependency "Google/SignIn"
1216
s.platform = :ios
1317
s.ios.deployment_target = "8.0"
14-
s.ios.framework = "UIKit"
18+
s.ios.framework = "UIKit", "Accounts"
19+
s.xcconfig = { 'FRAMEWORK_SEARCH_PATHS' => '"$(PODS_ROOT)/Firebase"' }
1520
s.requires_arc = true
1621
end

FirebaseUI.xcodeproj/project.pbxproj

Lines changed: 314 additions & 48 deletions
Large diffs are not rendered by default.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// clang-format off
2+
3+
/*
4+
* Firebase UI Bindings iOS Library
5+
*
6+
* Copyright © 2015 Firebase - All Rights Reserved
7+
* https://www.firebase.com
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binaryform must reproduce the above copyright notice,
16+
* this list of conditions and the following disclaimer in the documentation
17+
* and/or other materials provided with the distribution.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
20+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22+
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
23+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27+
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
#import <UIKit/UIKit.h>
32+
33+
#import <Firebase/Firebase.h>
34+
35+
#if LOCAL_BUILD
36+
#import <GoogleSignIn/GoogleSignIn.h>
37+
#import "GGLContext.h"
38+
#else
39+
#import <Google/SignIn.h>
40+
#endif
41+
42+
#import <FBSDKCoreKit/FBSDKCoreKit.h>
43+
#import <FBSDKLoginKit/FBSDKLoginKit.h>
44+
45+
/**
46+
* A replacement for the AppDelegate which includes setup for the Google and Facebook SDK's
47+
* Implements -application:didFinishLaunchingWithOptions: and -application:openURL:sourceApplication:annotation:
48+
* so make sure to call the appropriate superclass methods if you override those in a concrete implementation.
49+
*/
50+
@interface FirebaseAppDelegate : UIResponder<UIApplicationDelegate>
51+
52+
@property (strong, nonatomic) UIWindow *window;
53+
54+
@end
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
// clang-format off
2+
3+
/*
4+
* Firebase UI Bindings iOS Library
5+
*
6+
* Copyright © 2015 Firebase - All Rights Reserved
7+
* https://www.firebase.com
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binaryform must reproduce the above copyright notice,
16+
* this list of conditions and the following disclaimer in the documentation
17+
* and/or other materials provided with the distribution.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
20+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22+
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
23+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27+
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
// clang-format on
32+
33+
#import <Foundation/Foundation.h>
34+
#import <CoreGraphics/CGBase.h>
35+
36+
#ifndef FirebaseAuthConstants_h
37+
#define FirebaseAuthConstants_h
38+
39+
FOUNDATION_EXPORT NSString *const kFWPRequestType;
40+
41+
FOUNDATION_EXPORT NSString *const kTwitterAuthProvider;
42+
FOUNDATION_EXPORT NSString *const kTwitterApiKey;
43+
44+
FOUNDATION_EXPORT NSString *const kFacebookAuthProvider;
45+
FOUNDATION_EXPORT NSString *const kFacebookAppId;
46+
FOUNDATION_EXPORT NSString *const kFacebookDisplayName;
47+
FOUNDATION_EXPORT NSString *const kFacebookEmailScope;
48+
49+
FOUNDATION_EXPORT NSString *const kGoogleAuthProvider;
50+
51+
FOUNDATION_EXPORT NSString *const kPasswordAuthProvider;
52+
53+
FOUNDATION_EXPORT CGFloat const kHeaderWidth;
54+
FOUNDATION_EXPORT CGFloat const kHeaderHeight;
55+
FOUNDATION_EXPORT CGFloat const kHeaderSpace;
56+
57+
FOUNDATION_EXPORT CGFloat const kTextFieldWidth;
58+
FOUNDATION_EXPORT CGFloat const kTextFieldHeight;
59+
FOUNDATION_EXPORT CGFloat const kTextFieldSpace;
60+
61+
FOUNDATION_EXPORT CGFloat const kButtonWidth;
62+
FOUNDATION_EXPORT CGFloat const kButtonHeight;
63+
FOUNDATION_EXPORT CGFloat const kButtonSpace;
64+
65+
FOUNDATION_EXPORT CGFloat const kSeparatorWidth;
66+
FOUNDATION_EXPORT CGFloat const kSeparatorHeight;
67+
FOUNDATION_EXPORT CGFloat const kSeparatorSpace;
68+
69+
#endif /* FirebaseAuthConstants_h */
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// clang-format off
2+
3+
/*
4+
* Firebase UI Bindings iOS Library
5+
*
6+
* Copyright © 2015 Firebase - All Rights Reserved
7+
* https://www.firebase.com
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binaryform must reproduce the above copyright notice,
16+
* this list of conditions and the following disclaimer in the documentation
17+
* and/or other materials provided with the distribution.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
20+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22+
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
23+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27+
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
// clang-format on
32+
33+
#import <UIKit/UIKit.h>
34+
35+
#import <Firebase/Firebase.h>
36+
37+
#import "FirebaseAuthDelegate.h"
38+
#import "FirebaseAuthConstants.h"
39+
40+
/**
41+
* The base auth provider class that authenticates a user with an identity provider
42+
* to a Firebase reference. Subclass this to add support for new identity providers.
43+
*/
44+
@interface FirebaseAuthProvider : NSObject
45+
46+
/**
47+
* The Firebase reference to authenticate against
48+
*/
49+
@property(strong, nonatomic) Firebase *ref;
50+
51+
/**
52+
* The Firebase authentication data for the currently authenticated user
53+
*/
54+
@property(strong, nonatomic) FAuthData *authData;
55+
56+
/**
57+
* A string which represents the chosen authentication provider.
58+
* See FAuthenticationConstants.h for a full list.
59+
*/
60+
@property(strong, nonatomic) NSString *provider;
61+
62+
/**
63+
* FirebaseAuthDelegate delegate to handle all login, logout, and error events
64+
* from both authentication providers and Firebase
65+
*/
66+
@property(weak, nonatomic) id<FirebaseAuthDelegate> delegate;
67+
68+
/**
69+
* Create an instance of FirebaseAuthProvider, which allows for simple authentication to Firebase
70+
* via various identity providers (social, email/password, etc.). This method should be called
71+
* by subclasses
72+
* @param ref The Firebase reference to use for authentication
73+
* @param authDelegate A class that implements the FirebaseAuthDelegate protocol
74+
* @return FirebaseAuthProvider
75+
*/
76+
- (instancetype)initWithRef:(Firebase *)ref authDelegate:(id<FirebaseAuthDelegate>)authDelegate;
77+
78+
/**
79+
* Log in to the selected authentication provider.
80+
* Note: you must override this method, as the default implementation raises an exception.
81+
* @return void
82+
*/
83+
- (void)login;
84+
85+
/**
86+
* Logout of the currently authenticated provider
87+
* Note: Always call [super logout] in subclass overrides
88+
* @return void
89+
*/
90+
- (void)logout;
91+
92+
/**
93+
* Configure the current authentication provider (for instance, by retrieving keys, testing URL
94+
* schemes, etc.)
95+
* Note: you must override this method, as the default implementation raises an exception.
96+
* @return void
97+
*/
98+
- (void)configureProvider;
99+
100+
- (void)handleError:(NSError *)error;
101+
102+
@end
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// clang-format off
2+
3+
/*
4+
* Firebase UI Bindings iOS Library
5+
*
6+
* Copyright © 2015 Firebase - All Rights Reserved
7+
* https://www.firebase.com
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binaryform must reproduce the above copyright notice,
16+
* this list of conditions and the following disclaimer in the documentation
17+
* and/or other materials provided with the distribution.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
20+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22+
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
23+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27+
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
// clang-format on
32+
33+
#import <Firebase/Firebase.h>
34+
35+
#import <FBSDKCoreKit/FBSDKCoreKit.h>
36+
#import <FBSDKLoginKit/FBSDKLoginKit.h>
37+
38+
#import "FirebaseAuthProvider.h"
39+
40+
/**
41+
* An authentication provider class that authenticates a user with Facebook
42+
* and uses the credentials to authenticate a Firebase reference
43+
*/
44+
@interface FirebaseFacebookAuthProvider : FirebaseAuthProvider
45+
46+
/**
47+
* A Facebook Login Manager object for handling Facebook authentication
48+
*/
49+
@property(strong, nonatomic) FBSDKLoginManager *loginManager;
50+
51+
@end
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// clang-format off
2+
3+
/*
4+
* Firebase UI Bindings iOS Library
5+
*
6+
* Copyright © 2015 Firebase - All Rights Reserved
7+
* https://www.firebase.com
8+
*
9+
* Redistribution and use in source and binary forms, with or without
10+
* modification, are permitted provided that the following conditions are met:
11+
*
12+
* 1. Redistributions of source code must retain the above copyright notice, this
13+
* list of conditions and the following disclaimer.
14+
*
15+
* 2. Redistributions in binaryform must reproduce the above copyright notice,
16+
* this list of conditions and the following disclaimer in the documentation
17+
* and/or other materials provided with the distribution.
18+
*
19+
* THIS SOFTWARE IS PROVIDED BY FIREBASE AS IS AND ANY EXPRESS OR
20+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21+
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
22+
* EVENT SHALL FIREBASE BE LIABLE FOR ANY DIRECT,
23+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24+
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
26+
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
27+
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28+
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
*/
30+
31+
// clang-format on
32+
33+
#import <Firebase/Firebase.h>
34+
35+
#if LOCAL_BUILD
36+
#import <GoogleSignIn/GoogleSignIn.h>
37+
#else
38+
#import <Google/SignIn.h>
39+
#endif
40+
41+
#import "FirebaseAuthProvider.h"
42+
43+
/**
44+
* An authentication provider class that authenticates a user with Google
45+
* and uses the credentials to authenticate a Firebase reference
46+
*/
47+
@interface FirebaseGoogleAuthProvider : FirebaseAuthProvider<GIDSignInDelegate, GIDSignInUIDelegate>
48+
49+
/**
50+
* Create an instance of FirebaseGoogleAuthProvider, which allows for simple authentication to
51+
* Firebase via Gooogle
52+
* @param ref The Firebase reference to use for authentication
53+
* @param authDelegate A class that implements the FirebaseAuthDelegate protocol
54+
* @param uiDelegate A UIViewController subclass that implements the GIDSignInUIDelegate protocol
55+
* @return FirebaseGoogleAuthProvider
56+
*/
57+
- (instancetype)initWithRef:(Firebase *)ref
58+
authDelegate:(id<FirebaseAuthDelegate>)authDelegate
59+
uiDelegate:(UIViewController<GIDSignInUIDelegate> *)uiDelegate;
60+
61+
@end

0 commit comments

Comments
 (0)