Skip to content

Commit 59e9ed9

Browse files
authored
Merge pull request #612 from AzureAD/oldalton/improve_error_logging
Improve error logging when creating claims
2 parents 19d1e83 + 72aac9a commit 59e9ed9

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

IdentityCore/src/oauth2/aad_v1/MSIDAADV1IdTokenClaims.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ - (void)initDerivedProperties
9292

9393
_userId = [MSIDHelpers normalizeUserId:_userId];
9494

95+
if (!self.issuer)
96+
{
97+
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, nil, @"Issuer is not present in the provided AAD v1 id token claims");
98+
return;
99+
}
100+
95101
NSError *issuerError = nil;
96102
_issuerAuthority = [[MSIDAADAuthority alloc] initWithURL:[NSURL URLWithString:self.issuer] rawTenant:nil context:nil error:&issuerError];
97103

IdentityCore/src/oauth2/aad_v2/MSIDAADV2IdTokenClaims.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ - (void)initDerivedProperties
6565
_userId = [MSIDHelpers normalizeUserId:userId];
6666
_userIdDisplayable = YES;
6767

68+
if (!self.issuer)
69+
{
70+
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, nil, @"Issuer is not present in the provided AAD v2 id token claims");
71+
return;
72+
}
73+
6874
NSError *issuerError = nil;
6975
_issuerAuthority = [[MSIDAADAuthority alloc] initWithURL:[NSURL URLWithString:self.issuer] rawTenant:nil context:nil error:&issuerError];
7076

IdentityCore/src/oauth2/b2c/MSIDB2CIdTokenClaims.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ - (void)initDerivedProperties
5252

5353
_userId = [MSIDHelpers normalizeUserId:userId];
5454

55+
if (!self.issuer)
56+
{
57+
MSID_LOG_WITH_CTX(MSIDLogLevelInfo, nil, @"Issuer is not present in the provided B2C id token claims");
58+
return;
59+
}
60+
5561
NSError *issuerError = nil;
5662
_issuerAuthority = [[MSIDB2CAuthority alloc] initWithURL:[NSURL URLWithString:self.issuer] validateFormat:NO context:nil error:&issuerError];
5763

0 commit comments

Comments
 (0)