123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- /*
- * Copyright 2017 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/LICENSE-2.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.
- */
-
- #import "FIRCreateAuthURIRequest.h"
-
- NS_ASSUME_NONNULL_BEGIN
-
- /** @var kCreateAuthURIEndpoint
- @brief The "createAuthUri" endpoint.
- */
- static NSString *const kCreateAuthURIEndpoint = @"createAuthUri";
-
- /** @var kProviderIDKey
- @brief The key for the "providerId" value in the request.
- */
- static NSString *const kProviderIDKey = @"providerId";
-
- /** @var kIdentifierKey
- @brief The key for the "identifier" value in the request.
- */
- static NSString *const kIdentifierKey = @"identifier";
-
- /** @var kContinueURIKey
- @brief The key for the "continueUri" value in the request.
- */
- static NSString *const kContinueURIKey = @"continueUri";
-
- /** @var kOpenIDRealmKey
- @brief The key for the "openidRealm" value in the request.
- */
- static NSString *const kOpenIDRealmKey = @"openidRealm";
-
- /** @var kClientIDKey
- @brief The key for the "clientId" value in the request.
- */
- static NSString *const kClientIDKey = @"clientId";
-
- /** @var kContextKey
- @brief The key for the "context" value in the request.
- */
- static NSString *const kContextKey = @"context";
-
- /** @var kAppIDKey
- @brief The key for the "appId" value in the request.
- */
- static NSString *const kAppIDKey = @"appId";
-
- @implementation FIRCreateAuthURIRequest
-
- - (nullable instancetype)initWithIdentifier:(NSString *)identifier
- continueURI:(NSString *)continueURI
- requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration {
- self = [super initWithEndpoint:kCreateAuthURIEndpoint requestConfiguration:requestConfiguration];
- if (self) {
- _identifier = [identifier copy];
- _continueURI = [continueURI copy];
- }
- return self;
- }
-
- - (nullable id)unencodedHTTPRequestBodyWithError:(NSError *_Nullable *_Nullable)error {
- NSMutableDictionary *postBody = [@{
- kIdentifierKey : _identifier,
- kContinueURIKey : _continueURI
- } mutableCopy];
- if (_providerID) {
- postBody[kProviderIDKey] = _providerID;
- }
- if (_openIDRealm) {
- postBody[kOpenIDRealmKey] = _openIDRealm;
- }
- if (_clientID) {
- postBody[kClientIDKey] = _clientID;
- }
- if (_context) {
- postBody[kContextKey] = _context;
- }
- if (_appID) {
- postBody[kAppIDKey] = _appID;
- }
- return postBody;
- }
-
- @end
-
- NS_ASSUME_NONNULL_END
|