Files
firebase-ios-sdk/FirebaseAuth/Sources/MultiFactor/FIRMultiFactorSession.m
T

52 lines
1.4 KiB
Objective-C
Raw Normal View History

2020-03-10 13:30:20 -07:00
/*
* Copyright 2019 Google
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2020-07-09 13:31:53 -07:00
#import <TargetConditionals.h>
2020-03-10 13:30:20 -07:00
#if TARGET_OS_IOS
2020-07-27 15:21:19 -07:00
#import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRAuth.h"
#import "FirebaseAuth/Sources/Public/FirebaseAuth/FIRMultiFactorSession.h"
2020-03-10 13:30:20 -07:00
2020-04-10 11:54:51 -07:00
#import "FirebaseAuth/Sources/MultiFactor/FIRMultiFactorSession+Internal.h"
#import "FirebaseAuth/Sources/User/FIRUser_Internal.h"
2020-03-10 13:30:20 -07:00
NS_ASSUME_NONNULL_BEGIN
@implementation FIRMultiFactorSession
#pragma mark - Private
2020-03-11 10:15:27 -07:00
- (instancetype)initWithIDToken:(NSString *)IDToken {
2020-03-10 13:30:20 -07:00
self = [super init];
if (self) {
2020-03-11 10:15:27 -07:00
_IDToken = IDToken;
2020-03-10 13:30:20 -07:00
}
return self;
}
#pragma mark - Internal
+ (FIRMultiFactorSession *)sessionForCurrentUser {
FIRUser *currentUser = [[FIRAuth auth] currentUser];
2020-03-11 10:15:27 -07:00
NSString *IDToken = currentUser.rawAccessToken;
FIRMultiFactorSession *session = [[FIRMultiFactorSession alloc] initWithIDToken:IDToken];
2020-03-10 13:30:20 -07:00
return session;
}
@end
NS_ASSUME_NONNULL_END
#endif