Skip to content

Commit 37bd94f

Browse files
Revert "Add OIDC nonce support (#4183)" (#4220) (#4222)
This reverts commit ffe4a3a.
1 parent 28f56d7 commit 37bd94f

File tree

11 files changed

+2
-125
lines changed

11 files changed

+2
-125
lines changed

Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthCredential.m

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626

2727
@interface FIROAuthCredential ()
2828

29-
@property(nonatomic, nullable) NSString *rawNonce;
30-
3129
- (nullable instancetype)initWithProvider:(NSString *)provider NS_UNAVAILABLE;
3230

3331
@end
@@ -42,14 +40,12 @@ - (nullable instancetype)initWithProvider:(NSString *)provider {
4240

4341
- (instancetype)initWithProviderID:(NSString *)providerID
4442
IDToken:(nullable NSString *)IDToken
45-
rawNonce:(nullable NSString *)rawNonce
4643
accessToken:(nullable NSString *)accessToken
4744
secret:(nullable NSString *)secret
4845
pendingToken:(nullable NSString *)pendingToken {
4946
self = [super initWithProvider:providerID];
5047
if (self) {
5148
_IDToken = IDToken;
52-
_rawNonce = rawNonce;
5349
_accessToken = accessToken;
5450
_pendingToken = pendingToken;
5551
_secret = secret;
@@ -60,12 +56,8 @@ - (instancetype)initWithProviderID:(NSString *)providerID
6056
- (instancetype)initWithProviderID:(NSString *)providerID
6157
sessionID:(NSString *)sessionID
6258
OAuthResponseURLString:(NSString *)OAuthResponseURLString {
63-
self = [self initWithProviderID:providerID
64-
IDToken:nil
65-
rawNonce:nil
66-
accessToken:nil
67-
secret:nil
68-
pendingToken:nil];
59+
self =
60+
[self initWithProviderID:providerID IDToken:nil accessToken:nil secret:nil pendingToken:nil];
6961
if (self) {
7062
_OAuthResponseURLString = OAuthResponseURLString;
7163
_sessionID = sessionID;
@@ -79,7 +71,6 @@ - (nullable instancetype)initWithVerifyAssertionResponse:(FIRVerifyAssertionResp
7971
response.oauthSecretToken.length) {
8072
return [self initWithProviderID:response.providerID
8173
IDToken:response.oauthIDToken
82-
rawNonce:nil
8374
accessToken:response.oauthAccessToken
8475
secret:response.oauthSecretToken
8576
pendingToken:response.pendingToken];
@@ -89,7 +80,6 @@ - (nullable instancetype)initWithVerifyAssertionResponse:(FIRVerifyAssertionResp
8980

9081
- (void)prepareVerifyAssertionRequest:(FIRVerifyAssertionRequest *)request {
9182
request.providerIDToken = _IDToken;
92-
request.providerRawNonce = _rawNonce;
9383
request.providerAccessToken = _accessToken;
9484
request.requestURI = _OAuthResponseURLString;
9585
request.sessionID = _sessionID;
@@ -105,13 +95,11 @@ + (BOOL)supportsSecureCoding {
10595

10696
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
10797
NSString *IDToken = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"IDToken"];
108-
NSString *rawNonce = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"rawNonce"];
10998
NSString *accessToken = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"accessToken"];
11099
NSString *pendingToken = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"pendingToken"];
111100
NSString *secret = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"secret"];
112101
self = [self initWithProviderID:self.provider
113102
IDToken:IDToken
114-
rawNonce:rawNonce
115103
accessToken:accessToken
116104
secret:secret
117105
pendingToken:pendingToken];
@@ -120,7 +108,6 @@ - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder {
120108

121109
- (void)encodeWithCoder:(NSCoder *)aCoder {
122110
[aCoder encodeObject:self.IDToken forKey:@"IDToken"];
123-
[aCoder encodeObject:self.IDToken forKey:@"rawNonce"];
124111
[aCoder encodeObject:self.accessToken forKey:@"accessToken"];
125112
[aCoder encodeObject:self.pendingToken forKey:@"pendingToken"];
126113
[aCoder encodeObject:self.secret forKey:@"secret"];

Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthCredential_Internal.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,12 @@ NS_ASSUME_NONNULL_BEGIN
4646
@brief Designated initializer.
4747
@param providerID The provider ID associated with the credential being created.
4848
@param IDToken The ID Token associated with the credential being created.
49-
@param rawNonce The raw nonce associated with the Auth credential being created.
5049
@param accessToken The access token associated with the credential being created.
5150
@param secret The secret associated with the credential being created.
5251
@param pendingToken The pending token associated with the credential being created.
5352
*/
5453
- (instancetype)initWithProviderID:(NSString *)providerID
5554
IDToken:(nullable NSString *)IDToken
56-
rawNonce:(nullable NSString *)rawNonce
5755
accessToken:(nullable NSString *)accessToken
5856
secret:(nullable NSString *)secret
5957
pendingToken:(nullable NSString *)pendingToken NS_DESIGNATED_INITIALIZER;

Firebase/Auth/Source/AuthProvider/OAuth/FIROAuthProvider.m

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
7171
accessToken:(nullable NSString *)accessToken {
7272
return [[FIROAuthCredential alloc] initWithProviderID:providerID
7373
IDToken:IDToken
74-
rawNonce:nil
7574
accessToken:accessToken
7675
secret:nil
7776
pendingToken:nil];
@@ -81,35 +80,11 @@ + (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
8180
accessToken:(NSString *)accessToken {
8281
return [[FIROAuthCredential alloc] initWithProviderID:providerID
8382
IDToken:nil
84-
rawNonce:nil
8583
accessToken:accessToken
8684
secret:nil
8785
pendingToken:nil];
8886
}
8987

90-
+ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
91-
IDToken:(NSString *)IDToken
92-
rawNonce:(nullable NSString *)rawNonce
93-
accessToken:(nullable NSString *)accessToken {
94-
return [[FIROAuthCredential alloc] initWithProviderID:providerID
95-
IDToken:IDToken
96-
rawNonce:rawNonce
97-
accessToken:accessToken
98-
secret:nil
99-
pendingToken:nil];
100-
}
101-
102-
+ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
103-
IDToken:(NSString *)IDToken
104-
rawNonce:(nullable NSString *)rawNonce {
105-
return [[FIROAuthCredential alloc] initWithProviderID:providerID
106-
IDToken:IDToken
107-
rawNonce:rawNonce
108-
accessToken:nil
109-
secret:nil
110-
pendingToken:nil];
111-
}
112-
11388
+ (instancetype)providerWithProviderID:(NSString *)providerID {
11489
return [[self alloc]initWithProviderID:providerID auth:[FIRAuth auth]];
11590
}

Firebase/Auth/Source/Backend/FIRAuthBackend.m

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -342,11 +342,6 @@
342342
*/
343343
static NSString *const kSessionExpiredErrorMessage = @"SESSION_EXPIRED";
344344

345-
/** @var kMissingOrInvalidNonceErrorMessage
346-
@brief This is the error message the server will respond with if the nonce is missing or invalid.
347-
*/
348-
static NSString *const kMissingOrInvalidNonceErrorMessage = @"MISSING_OR_INVALID_NONCE";
349-
350345
/** @var kMissingAppTokenErrorMessage
351346
@brief This is the error message the server will respond with if the APNS token is missing in a
352347
verifyClient request.
@@ -1181,10 +1176,6 @@ + (nullable NSError *)clientErrorWithServerErrorMessage:(NSString *)serverErrorM
11811176
return [FIRAuthErrorUtils captchaCheckFailedErrorWithMessage:serverErrorMessage];
11821177
}
11831178

1184-
if ([shortErrorMessage isEqualToString:kMissingOrInvalidNonceErrorMessage]) {
1185-
return [FIRAuthErrorUtils missingOrInvalidNonceErrorWithMessage:serverDetailErrorMessage];
1186-
}
1187-
11881179
// In this case we handle an error that might be specified in the underlying errors dictionary,
11891180
// the error message in determined based on the @c reason key in the dictionary.
11901181
if (errorDictionary[kErrorsKey]) {

Firebase/Auth/Source/Backend/RPC/FIRVerifyAssertionRequest.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ NS_ASSUME_NONNULL_BEGIN
6666
*/
6767
@property(nonatomic, copy, nullable) NSString *providerIDToken;
6868

69-
/** @property providerRawNonce
70-
@brief An raw nonce from the IDP.
71-
*/
72-
@property(nonatomic, copy, nullable) NSString *providerRawNonce;
73-
7469
/** @property returnIDPCredential
7570
@brief Whether the response should return the IDP credential directly.
7671
*/

Firebase/Auth/Source/Backend/RPC/FIRVerifyAssertionRequest.m

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@
3333
*/
3434
static NSString *const kProviderIDTokenKey = @"id_token";
3535

36-
/** @var kProviderNonceKey
37-
@brief The key for the "nonce" value in the request.
38-
*/
39-
static NSString *const kProviderNonceKey = @"nonce";
40-
4136
/** @var kProviderAccessTokenKey
4237
@brief The key for the "access_token" value in the request.
4338
*/
@@ -120,11 +115,6 @@ - (nullable id)unencodedHTTPRequestBodyWithError:(NSError *_Nullable *_Nullable)
120115
value:_providerIDToken]];
121116
}
122117

123-
if (_providerRawNonce) {
124-
[queryItems addObject:[NSURLQueryItem queryItemWithName:kProviderNonceKey
125-
value:_providerRawNonce]];
126-
}
127-
128118
if (_providerAccessToken) {
129119
[queryItems addObject:[NSURLQueryItem queryItemWithName:kProviderAccessTokenKey
130120
value:_providerAccessToken]];

Firebase/Auth/Source/Public/FIRAuthErrors.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,6 @@ typedef NS_ENUM(NSInteger, FIRAuthErrorCode) {
343343
*/
344344
FIRAuthErrorCodeGameKitNotLinked = 17076,
345345

346-
/** Indicates that the nonce is missing or invalid.
347-
*/
348-
FIRAuthErrorCodeMissingOrInvalidNonce = 17094,
349-
350346
/** Indicates an error for when the client identifier is missing.
351347
*/
352348
FIRAuthErrorCodeMissingClientIdentifier = 17993,

Firebase/Auth/Source/Public/FIROAuthProvider.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -85,35 +85,6 @@ NS_SWIFT_NAME(OAuthProvider)
8585
+ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
8686
accessToken:(NSString *)accessToken;
8787

88-
/** @fn credentialWithProviderID:IDToken:rawNonce:accessToken:
89-
@brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID, ID
90-
token, raw nonce and access token.
91-
92-
@param providerID The provider ID associated with the Auth credential being created.
93-
@param IDToken The IDToken associated with the Auth credential being created.
94-
@param rawNonce The raw nonce associated with the Auth credential being created.
95-
@param accessToken The accessstoken associated with the Auth credential be created, if
96-
available.
97-
@return A FIRAuthCredential for the specified provider ID, ID token and access token.
98-
*/
99-
+ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
100-
IDToken:(NSString *)IDToken
101-
rawNonce:(nullable NSString *)rawNonce
102-
accessToken:(nullable NSString *)accessToken;
103-
104-
/** @fn credentialWithProviderID:IDToken:rawNonce:
105-
@brief Creates an `FIRAuthCredential` for that OAuth 2 provider identified by providerID using
106-
an ID token and raw nonce.
107-
108-
@param providerID The provider ID associated with the Auth credential being created.
109-
@param IDToken The IDToken associated with the Auth credential being created.
110-
@param rawNonce The raw nonce associated with the Auth credential being created.
111-
@return A FIRAuthCredential.
112-
*/
113-
+ (FIROAuthCredential *)credentialWithProviderID:(NSString *)providerID
114-
IDToken:(NSString *)IDToken
115-
rawNonce:(nullable NSString *)rawNonce;
116-
11788
/** @fn init
11889
@brief This class is not meant to be initialized.
11990
*/

Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -556,13 +556,6 @@ NS_ASSUME_NONNULL_BEGIN
556556
*/
557557
+ (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status;
558558

559-
/** @fn missingOrInvalidNonceErrorWithMessage:
560-
@brief Constructs an @c NSError with the code and message provided.
561-
@param message Error message from the backend, if any.
562-
@return The nullable NSError instance associated with the given error message, if one is found.
563-
*/
564-
+ (NSError *)missingOrInvalidNonceErrorWithMessage:(nullable NSString *)message;
565-
566559
@end
567560

568561
NS_ASSUME_NONNULL_END

Firebase/Auth/Source/Utilities/FIRAuthErrorUtils.m

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,6 @@
463463
static NSString *const kFIRAuthErrorMessageRejectedCredential =
464464
@"The request contains malformed or mismatching credentials.";
465465

466-
/** @var kFIRAuthErrorMessageMissingOrInvalidNonce
467-
@brief Error message constant describing @c FIRAuthErrorCodeMissingOrInvalidNonce errors.
468-
*/
469-
static NSString *const kFIRAuthErrorMessageMissingOrInvalidNonce =
470-
@"The request contains malformed or mismatched credentials.";
471-
472466
/** @var FIRAuthErrorDescription
473467
@brief The error descrioption, based on the error code.
474468
@remarks No default case so that we get a compiler warning if a new value was added to the enum.
@@ -605,8 +599,6 @@
605599
return kFIRAuthErrorMessageDynamicLinkNotActivated;
606600
case FIRAuthErrorCodeRejectedCredential:
607601
return kFIRAuthErrorMessageRejectedCredential;
608-
case FIRAuthErrorCodeMissingOrInvalidNonce:
609-
return kFIRAuthErrorMessageMissingOrInvalidNonce;
610602
}
611603
}
612604

@@ -746,8 +738,6 @@
746738
return @"ERROR_DYNAMIC_LINK_NOT_ACTIVATED";
747739
case FIRAuthErrorCodeRejectedCredential:
748740
return @"ERROR_REJECTED_CREDENTIAL";
749-
case FIRAuthErrorCodeMissingOrInvalidNonce:
750-
return @"ERROR_MISSING_OR_INVALID_NONCE";
751741
}
752742
}
753743

@@ -1189,10 +1179,6 @@ + (NSError *)invalidDynamicLinkDomainErrorWithMessage:(nullable NSString *)messa
11891179
return [self errorWithCode:FIRAuthInternalErrorCodeInvalidDynamicLinkDomain message:message];
11901180
}
11911181

1192-
+ (NSError *)missingOrInvalidNonceErrorWithMessage:(nullable NSString *)message {
1193-
return [self errorWithCode:FIRAuthInternalErrorCodeMissingOrInvalidNonce message:message];
1194-
}
1195-
11961182
+ (NSError *)keychainErrorWithFunction:(NSString *)keychainFunction status:(OSStatus)status {
11971183
NSString *failureReason = [NSString stringWithFormat:@"%@ (%li)", keychainFunction, (long)status];
11981184
return [self errorWithCode:FIRAuthInternalErrorCodeKeychainError userInfo:@{

0 commit comments

Comments
 (0)