Skip to content

Commit 287601f

Browse files
authored
Merge pull request #146 from AzureAD/oldalton/move_authority_aliases_to_factory
Removed no authority cache lookup logic and moved AAD authority aliasing specific logic to the factory
2 parents 30b15d8 + 9c814da commit 287601f

Some content is hidden

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

46 files changed

+1455
-1287
lines changed

IdentityCore/IdentityCore.xcodeproj/project.pbxproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,8 @@
317317
B275520B208185E600AA7A38 /* KeyvaultAuthentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = B275520A208185E600AA7A38 /* KeyvaultAuthentication.swift */; };
318318
B275520C208185E600AA7A38 /* KeyvaultAuthentication.swift in Sources */ = {isa = PBXBuildFile; fileRef = B275520A208185E600AA7A38 /* KeyvaultAuthentication.swift */; };
319319
B275520E208186F500AA7A38 /* MSIDAutomation-Bridging-Header.h in Headers */ = {isa = PBXBuildFile; fileRef = B275520D208186F500AA7A38 /* MSIDAutomation-Bridging-Header.h */; };
320+
B279835A20D33A0A0051167F /* MSIDIdTokenClaimsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B279835920D33A090051167F /* MSIDIdTokenClaimsTests.m */; };
321+
B279835B20D33A0A0051167F /* MSIDIdTokenClaimsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B279835920D33A090051167F /* MSIDIdTokenClaimsTests.m */; };
320322
B2807FF7204CAFDF00944D89 /* MSIDHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = B2807FF5204CAFDF00944D89 /* MSIDHelpers.h */; };
321323
B2807FF8204CAFDF00944D89 /* MSIDHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = B2807FF6204CAFDF00944D89 /* MSIDHelpers.m */; };
322324
B2807FF9204CAFDF00944D89 /* MSIDHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = B2807FF6204CAFDF00944D89 /* MSIDHelpers.m */; };
@@ -426,6 +428,9 @@
426428
B2CDB5871FE3427F003A4B5C /* MSIDAADV1IdTokenClaims.m in Sources */ = {isa = PBXBuildFile; fileRef = B2CDB5841FE3427F003A4B5C /* MSIDAADV1IdTokenClaims.m */; };
427429
B2D1841E2083CDE90001D445 /* MSIDVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = B20E3CB11FC4FA550029C097 /* MSIDVersion.m */; };
428430
B2D1841F2083CDEA0001D445 /* MSIDVersion.m in Sources */ = {isa = PBXBuildFile; fileRef = B20E3CB11FC4FA550029C097 /* MSIDVersion.m */; };
431+
B2D5625820CCD50E00FFF59C /* MSIDTelemetry+Cache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D5625620CCD50E00FFF59C /* MSIDTelemetry+Cache.h */; };
432+
B2D5625920CCD50E00FFF59C /* MSIDTelemetry+Cache.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D5625720CCD50E00FFF59C /* MSIDTelemetry+Cache.m */; };
433+
B2D5625A20CCD50E00FFF59C /* MSIDTelemetry+Cache.m in Sources */ = {isa = PBXBuildFile; fileRef = B2D5625720CCD50E00FFF59C /* MSIDTelemetry+Cache.m */; };
429434
B2D81BC01FF5C7520093859A /* MSIDTestBrokerResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = B2D81BBC1FF5C7460093859A /* MSIDTestBrokerResponse.h */; };
430435
B2DD4B2120A7D2F90047A66E /* MSIDLegacyAccessToken.h in Headers */ = {isa = PBXBuildFile; fileRef = B2DD4B1F20A7D2F90047A66E /* MSIDLegacyAccessToken.h */; };
431436
B2DD4B2220A7D2F90047A66E /* MSIDLegacyAccessToken.m in Sources */ = {isa = PBXBuildFile; fileRef = B2DD4B2020A7D2F90047A66E /* MSIDLegacyAccessToken.m */; };
@@ -836,6 +841,7 @@
836841
B27551FD208182BE00AA7A38 /* AuthHeader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthHeader.swift; sourceTree = "<group>"; };
837842
B275520A208185E600AA7A38 /* KeyvaultAuthentication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyvaultAuthentication.swift; sourceTree = "<group>"; };
838843
B275520D208186F500AA7A38 /* MSIDAutomation-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MSIDAutomation-Bridging-Header.h"; sourceTree = "<group>"; };
844+
B279835920D33A090051167F /* MSIDIdTokenClaimsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDIdTokenClaimsTests.m; sourceTree = "<group>"; };
839845
B2807FF5204CAFDF00944D89 /* MSIDHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDHelpers.h; sourceTree = "<group>"; };
840846
B2807FF6204CAFDF00944D89 /* MSIDHelpers.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDHelpers.m; sourceTree = "<group>"; };
841847
B2807FFA204CB16B00944D89 /* MSIDHelperTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDHelperTests.m; sourceTree = "<group>"; };
@@ -900,6 +906,8 @@
900906
B2CDB5801FE33F64003A4B5C /* MSIDTestIdTokenUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MSIDTestIdTokenUtil.h; path = src/util/MSIDTestIdTokenUtil.h; sourceTree = SOURCE_ROOT; };
901907
B2CDB5831FE3427F003A4B5C /* MSIDAADV1IdTokenClaims.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDAADV1IdTokenClaims.h; sourceTree = "<group>"; };
902908
B2CDB5841FE3427F003A4B5C /* MSIDAADV1IdTokenClaims.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MSIDAADV1IdTokenClaims.m; sourceTree = "<group>"; };
909+
B2D5625620CCD50E00FFF59C /* MSIDTelemetry+Cache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MSIDTelemetry+Cache.h"; sourceTree = "<group>"; };
910+
B2D5625720CCD50E00FFF59C /* MSIDTelemetry+Cache.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "MSIDTelemetry+Cache.m"; sourceTree = "<group>"; };
903911
B2D81BBC1FF5C7460093859A /* MSIDTestBrokerResponse.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = MSIDTestBrokerResponse.h; path = tests/util/MSIDTestBrokerResponse.h; sourceTree = SOURCE_ROOT; };
904912
B2D81BBD1FF5C7460093859A /* MSIDTestBrokerResponse.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = MSIDTestBrokerResponse.m; path = tests/util/MSIDTestBrokerResponse.m; sourceTree = SOURCE_ROOT; };
905913
B2DD4B1F20A7D2F90047A66E /* MSIDLegacyAccessToken.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MSIDLegacyAccessToken.h; sourceTree = "<group>"; };
@@ -1355,6 +1363,8 @@
13551363
B206579A1FC91BE000412B7D /* MSIDTelemetryPiiOiiRules.m */,
13561364
B206579B1FC91BE000412B7D /* MSIDTelemetryUIEvent.h */,
13571365
B206578B1FC91BDF00412B7D /* MSIDTelemetryUIEvent.m */,
1366+
B2D5625620CCD50E00FFF59C /* MSIDTelemetry+Cache.h */,
1367+
B2D5625720CCD50E00FFF59C /* MSIDTelemetry+Cache.m */,
13581368
);
13591369
path = telemetry;
13601370
sourceTree = "<group>";
@@ -1817,6 +1827,7 @@
18171827
238EF0882091655D0035ABE6 /* MSIDHttpRequestTelemetryTests.m */,
18181828
B252913A2096698100E78695 /* MSIDAADIdTokenClaimsFactoryTests.m */,
18191829
B2DD4B4320A936FE0047A66E /* MSIDAccountCredentialsCacheTests.m */,
1830+
B279835920D33A090051167F /* MSIDIdTokenClaimsTests.m */,
18201831
);
18211832
path = tests;
18221833
sourceTree = "<group>";
@@ -1890,6 +1901,7 @@
18901901
B251CC202040F6C6005E0179 /* MSIDDefaultCredentialCacheKey.h in Headers */,
18911902
B20657A61FC91C9A00412B7D /* MSIDTelemetryEventInterface.h in Headers */,
18921903
B20657AE1FC91FB700412B7D /* MSIDTelemetryPiiOiiRules.h in Headers */,
1904+
B2D5625820CCD50E00FFF59C /* MSIDTelemetry+Cache.h in Headers */,
18931905
238E19E12086FE28004DF483 /* MSIDAuthorizationCodeGrantRequest.h in Headers */,
18941906
238EF038208FDBA20035ABE6 /* MSIDAADV1RefreshTokenGrantRequest.h in Headers */,
18951907
B20657AE1FC91FB700412B7D /* MSIDTelemetryPiiOiiRules.h in Headers */,
@@ -2294,6 +2306,7 @@
22942306
B2936F8020ABFFC50050C585 /* MSIDAADOauth2FactoryTests.m in Sources */,
22952307
B2936F5020AA954A0050C585 /* MSIDAccountCacheItemTests.m in Sources */,
22962308
B2808004204CB2A700944D89 /* MSIDAADV1TokenResponseTests.m in Sources */,
2309+
B279835A20D33A0A0051167F /* MSIDIdTokenClaimsTests.m in Sources */,
22972310
B2936F4F20AA908F0050C585 /* MSIDCredentialCacheItemTests.m in Sources */,
22982311
B2936F7520ABF4940050C585 /* MSIDIdTokenTests.m in Sources */,
22992312
B2936F9120AE913E0050C585 /* MSIDLegacyTokenCacheIntegrationTests.m in Sources */,
@@ -2406,6 +2419,7 @@
24062419
230847A82082C5830024CE7C /* MSIDHttpRequest.m in Sources */,
24072420
04D32CB31FD62141000B123E /* MSIDError.m in Sources */,
24082421
966D0A8620A0E9F300EDDE94 /* MSIDNetworkConfiguration.m in Sources */,
2422+
B2D5625A20CCD50E00FFF59C /* MSIDTelemetry+Cache.m in Sources */,
24092423
9641B52B1FCF3F3A00AFA0EC /* MSIDKeyedArchiverSerializer.m in Sources */,
24102424
B251CC57204109A4005E0179 /* MSIDCredentialCacheItem.m in Sources */,
24112425
238E19E32086FE28004DF483 /* MSIDAADAuthorizationCodeRequest.m in Sources */,
@@ -2528,6 +2542,7 @@
25282542
B2DD5B9F204761550084313F /* MSIDAccessTokenTests.m in Sources */,
25292543
B2DD5BC120479AA80084313F /* MSIDJsonSerializerTests.m in Sources */,
25302544
B2DD5BB2204789FB0084313F /* MSIDIdTokenTests.m in Sources */,
2545+
B279835B20D33A0A0051167F /* MSIDIdTokenClaimsTests.m in Sources */,
25312546
B20657D01FC92B8F00412B7D /* MSIDTelemetryUIEventTests.m in Sources */,
25322547
B26A0B972072B9CB006BD95A /* MSIDAADV1Oauth2FactoryTests.m in Sources */,
25332548
B2DD5BA2204761660084313F /* MSIDLegacySingleResourceTokenTests.m in Sources */,
@@ -2612,6 +2627,7 @@
26122627
23BDA67A1FCE693800FE14BE /* MSIDKeychainUtil.m in Sources */,
26132628
B2CDB5781FE33A3E003A4B5C /* MSIDAccount.m in Sources */,
26142629
238E19C12086FC38004DF483 /* MSIDJsonResponseSerializer.m in Sources */,
2630+
B2D5625920CCD50E00FFF59C /* MSIDTelemetry+Cache.m in Sources */,
26152631
B2CDB5861FE3427F003A4B5C /* MSIDAADV1IdTokenClaims.m in Sources */,
26162632
B2CDB5861FE3427F003A4B5C /* MSIDAADV1IdTokenClaims.m in Sources */,
26172633
B297E1EC20A1388E00F370EC /* MSIDDefaultAccountCacheQuery.m in Sources */,

IdentityCore/src/cache/MSIDCacheAccessor.h

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,37 +38,35 @@
3838
@protocol MSIDCacheAccessor <NSObject>
3939

4040
- (instancetype)initWithDataSource:(id<MSIDTokenCacheDataSource>)dataSource
41-
otherCacheAccessors:(NSArray<id<MSIDCacheAccessor>> *)otherAccessors;
41+
otherCacheAccessors:(NSArray<id<MSIDCacheAccessor>> *)otherAccessors
42+
factory:(MSIDOauth2Factory *)factory;
4243

4344
/*!
4445
This method saves all tokens to the cache based on the token response.
4546
All tokens include: access tokens, refresh tokens, id tokens, accounts depending on the SDK
4647
*/
47-
- (BOOL)saveTokensWithFactory:(MSIDOauth2Factory *)factory
48-
configuration:(MSIDConfiguration *)configuration
49-
response:(MSIDTokenResponse *)response
50-
context:(id<MSIDRequestContext>)context
51-
error:(NSError **)error;
48+
- (BOOL)saveTokensWithConfiguration:(MSIDConfiguration *)configuration
49+
response:(MSIDTokenResponse *)response
50+
context:(id<MSIDRequestContext>)context
51+
error:(NSError **)error;
5252

5353
/*!
5454
This method saves all tokens to the cache based on the broker response.
5555
All tokens include: access tokens, refresh tokens, id tokens, accounts depending on the SDK
5656
If saveSSOStateOnly flag is passed, it only saves SSO artifacts (refresh tokens and accounts)
5757
*/
58-
- (BOOL)saveTokensWithFactory:(MSIDOauth2Factory *)factory
59-
brokerResponse:(MSIDBrokerResponse *)response
60-
saveSSOStateOnly:(BOOL)saveSSOStateOnly
61-
context:(id<MSIDRequestContext>)context
62-
error:(NSError **)error;
58+
- (BOOL)saveTokensWithBrokerResponse:(MSIDBrokerResponse *)response
59+
saveSSOStateOnly:(BOOL)saveSSOStateOnly
60+
context:(id<MSIDRequestContext>)context
61+
error:(NSError **)error;
6362

6463
/*!
65-
This method saves only the SSO artifacts to the cache based on the broker response.
64+
This method saves only the SSO artifacts to the cache based on the response.
6665
*/
67-
- (BOOL)saveSSOStateWithFactory:(MSIDOauth2Factory *)factory
68-
configuration:(MSIDConfiguration *)configuration
69-
response:(MSIDTokenResponse *)response
70-
context:(id<MSIDRequestContext>)context
71-
error:(NSError **)error;
66+
- (BOOL)saveSSOStateWithConfiguration:(MSIDConfiguration *)configuration
67+
response:(MSIDTokenResponse *)response
68+
context:(id<MSIDRequestContext>)context
69+
error:(NSError **)error;
7270

7371
- (MSIDRefreshToken *)getRefreshTokenWithAccount:(MSIDAccountIdentifier *)account
7472
familyId:(NSString *)familyId

IdentityCore/src/cache/MSIDUserInformation.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ - (instancetype)initWithCoder:(NSCoder *)coder
6262

6363
- (MSIDIdTokenClaims *)idTokenClaims
6464
{
65-
return [[MSIDIdTokenClaims alloc] initWithRawIdToken:_rawIdToken];
65+
return [[MSIDIdTokenClaims alloc] initWithRawIdToken:_rawIdToken error:nil];
6666
}
6767

6868

0 commit comments

Comments
 (0)