Skip to content

Commit 614cca4

Browse files
committed
Address comments
1 parent 31a22e4 commit 614cca4

File tree

5 files changed

+47
-11
lines changed

5 files changed

+47
-11
lines changed

IdentityCore/IdentityCore.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1890,6 +1890,7 @@
18901890
E656E07A2C2627B80011FB23 /* MSIDWebUpgradeRegResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = E656E0792C2627B80011FB23 /* MSIDWebUpgradeRegResponse.m */; };
18911891
E656E07B2C2627B80011FB23 /* MSIDWebUpgradeRegResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = E656E0792C2627B80011FB23 /* MSIDWebUpgradeRegResponse.m */; };
18921892
E656E07D2C2627FB0011FB23 /* MSIDWebUpgradeRegResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = E656E07C2C2627FB0011FB23 /* MSIDWebUpgradeRegResponse.h */; };
1893+
E6B895AD2DD2AEE1000879AE /* MSIDSilentTokenRequest+Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = E6B895AC2DD2AEC2000879AE /* MSIDSilentTokenRequest+Internal.h */; };
18931894
E70C49F1258D662F00A7A07E /* MSIDLRUCache.m in Sources */ = {isa = PBXBuildFile; fileRef = E70C49F0258D662F00A7A07E /* MSIDLRUCache.m */; };
18941895
E70C49F2258D662F00A7A07E /* MSIDLRUCache.m in Sources */ = {isa = PBXBuildFile; fileRef = E70C49F0258D662F00A7A07E /* MSIDLRUCache.m */; };
18951896
E70C4A30258D68D900A7A07E /* MSIDThrottlingCacheRecord.m in Sources */ = {isa = PBXBuildFile; fileRef = E70C4A2F258D68D900A7A07E /* MSIDThrottlingCacheRecord.m */; };
@@ -3366,6 +3367,7 @@
33663367
D6D9A4BB1FBE712900EFA430 /* MSIDStringExtensionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MSIDStringExtensionsTests.m; sourceTree = "<group>"; };
33673368
E656E0792C2627B80011FB23 /* MSIDWebUpgradeRegResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDWebUpgradeRegResponse.m; sourceTree = "<group>"; };
33683369
E656E07C2C2627FB0011FB23 /* MSIDWebUpgradeRegResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDWebUpgradeRegResponse.h; sourceTree = "<group>"; };
3370+
E6B895AC2DD2AEC2000879AE /* MSIDSilentTokenRequest+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MSIDSilentTokenRequest+Internal.h"; sourceTree = "<group>"; };
33693371
E6FABC0A2C2A110900611378 /* MSIDWebWPJResponse+Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MSIDWebWPJResponse+Internal.h"; sourceTree = "<group>"; };
33703372
E70C49F0258D662F00A7A07E /* MSIDLRUCache.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDLRUCache.m; sourceTree = "<group>"; };
33713373
E70C4A2F258D68D900A7A07E /* MSIDThrottlingCacheRecord.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDThrottlingCacheRecord.m; sourceTree = "<group>"; };
@@ -5045,6 +5047,7 @@
50455047
23B01884235548C000207FEC /* MSIDInteractiveTokenRequest+Internal.h */,
50465048
B2AF1D2D218BCEDE0080C1A0 /* MSIDInteractiveTokenRequest.m */,
50475049
B2F671EB2467AB4500649855 /* MSIDInteractiveRequestControlling.h */,
5050+
E6B895AC2DD2AEC2000879AE /* MSIDSilentTokenRequest+Internal.h */,
50485051
B2AF1D31218BCEEB0080C1A0 /* MSIDSilentTokenRequest.h */,
50495052
B2AF1D32218BCEEB0080C1A0 /* MSIDSilentTokenRequest.m */,
50505053
B286B9542385F01A007833AD /* MSIDOIDCSignoutRequest.h */,
@@ -6126,6 +6129,7 @@
61266129
23C898162C8928DD00071482 /* MSIDBrowserNativeMessageGetSupportedContractsRequest.h in Headers */,
61276130
238E19E12086FE28004DF483 /* MSIDAuthorizationCodeGrantRequest.h in Headers */,
61286131
238EF038208FDBA20035ABE6 /* MSIDAADV1RefreshTokenGrantRequest.h in Headers */,
6132+
E6B895AD2DD2AEE1000879AE /* MSIDSilentTokenRequest+Internal.h in Headers */,
61296133
589BDB272718F18800BF3799 /* MSIDCredentialHeader.h in Headers */,
61306134
235480C620DDF81000246F72 /* MSIDADFSAuthority.h in Headers */,
61316135
96CE53E920C73E3A002E24C9 /* MSIDWebviewFactory.h in Headers */,
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// All rights reserved.
3+
//
4+
// This code is licensed under the MIT License.
5+
//
6+
// Permission is hereby granted, free of charge, to any person obtaining a copy
7+
// of this software and associated documentation files(the "Software"), to deal
8+
// in the Software without restriction, including without limitation the rights
9+
// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
10+
// copies of the Software, and to permit persons to whom the Software is
11+
// furnished to do so, subject to the following conditions :
12+
//
13+
// The above copyright notice and this permission notice shall be included in
14+
// all copies or substantial portions of the Software.
15+
//
16+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
// THE SOFTWARE.
23+
24+
#import <Foundation/Foundation.h>
25+
#import "MSIDCacheAccessor.h"
26+
#import "MSIDConstants.h"
27+
#import "MSIDThrottlingService.h"
28+
29+
@interface MSIDSilentTokenRequest (Internal)
30+
31+
- (BOOL)shouldRemoveAccountArtifacts:(nonnull NSError *)serverError;
32+
33+
@end
34+

IdentityCore/src/requests/MSIDSilentTokenRequest.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,10 +699,12 @@ - (BOOL)shouldRemoveRefreshToken:(__unused NSError *)serverError
699699
return NO;
700700
}
701701

702-
- (BOOL)shouldRemoveAccountArtifacts:(__unused NSError *)serverError
702+
- (BOOL)shouldRemoveAccountArtifacts:(nonnull NSError *)serverError
703703
{
704-
NSAssert(NO, @"Abstract method. Should be implemented in a subclass");
705-
return NO;
704+
// Removing account artifacts on invalid_grant + user_deleted_account suberror combination
705+
MSIDErrorCode oauthError = MSIDErrorCodeForOAuthError(serverError.msidOauthError, MSIDErrorInternal);
706+
NSString *subError = serverError.msidSubError;
707+
return oauthError == MSIDErrorServerInvalidGrant && [subError isEqualToString:MSIDServerErrorUserAccountDeleted];
706708
}
707709

708710
- (id<MSIDCacheAccessor>)tokenCache

IdentityCore/src/requests/sdk/adal/MSIDLegacySilentTokenRequest.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#import "MSIDAccessToken.h"
2929
#import "NSError+MSIDExtensions.h"
3030
#import "MSIDAccountMetadataCacheAccessor.h"
31+
#import "MSIDSilentTokenRequest+Internal.h"
3132

3233
@interface MSIDLegacySilentTokenRequest()
3334

@@ -102,10 +103,7 @@ - (BOOL)shouldRemoveRefreshToken:(NSError *)serverError
102103

103104
- (BOOL)shouldRemoveAccountArtifacts:(NSError *)serverError
104105
{
105-
// Removing account artifacts on invalid_grant + user_deleted_account suberror combination
106-
MSIDErrorCode oauthError = MSIDErrorCodeForOAuthError(serverError.msidOauthError, MSIDErrorInternal);
107-
NSString *subError = serverError.msidSubError;
108-
return oauthError == MSIDErrorServerInvalidGrant && [subError isEqualToString:MSIDServerErrorUserAccountDeleted];
106+
return [super shouldRemoveAccountArtifacts:serverError];
109107
}
110108

111109
- (id<MSIDCacheAccessor>)tokenCache

IdentityCore/src/requests/sdk/msal/MSIDDefaultSilentTokenRequest.m

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#import "MSIDAccountMetadataCacheAccessor.h"
3838
#import "MSIDTokenResponse.h"
3939
#import "MSIDThrottlingService.h"
40+
#import "MSIDSilentTokenRequest+Internal.h"
4041

4142
@interface MSIDDefaultSilentTokenRequest()
4243

@@ -228,10 +229,7 @@ - (BOOL)shouldRemoveRefreshToken:(NSError *)serverError
228229

229230
- (BOOL)shouldRemoveAccountArtifacts:(NSError *)serverError
230231
{
231-
// Removing account artifacts on invalid_grant + user_deleted_account suberror combination
232-
MSIDErrorCode oauthError = MSIDErrorCodeForOAuthError(serverError.msidOauthError, MSIDErrorInternal);
233-
NSString *subError = serverError.msidSubError;
234-
return oauthError == MSIDErrorServerInvalidGrant && [subError isEqualToString:MSIDServerErrorUserAccountDeleted];
232+
return [super shouldRemoveAccountArtifacts:serverError];
235233
}
236234

237235
- (id<MSIDCacheAccessor>)tokenCache

0 commit comments

Comments
 (0)