diff --git a/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResult.cs b/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResult.cs index a97499ee6..00707174a 100644 --- a/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResult.cs +++ b/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResult.cs @@ -144,5 +144,18 @@ internal void UpdateTenantAndUserInfo(string tenantId, string idToken, AdalUserI this.UserInfo = new AdalUserInfo(userInfo); } } + + internal AdalResult Clone() + { + var result = new AdalResult(AccessTokenType, AccessToken, ExpiresOn, ExtendedExpiresOn) + { + Authority = Authority, + ExtendedLifeTimeToken = ExtendedLifeTimeToken, + }; + + result.UpdateTenantAndUserInfo(TenantId, IdToken, UserInfo); + + return result; + } } } \ No newline at end of file diff --git a/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResultWrapper.cs b/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResultWrapper.cs index c058f44f2..e18036edf 100644 --- a/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResultWrapper.cs +++ b/src/Microsoft.IdentityModel.Clients.ActiveDirectory/Core/Cache/AdalResultWrapper.cs @@ -110,7 +110,15 @@ public string Serialize() internal AdalResultWrapper Clone() { - return Deserialize(Serialize()); + return new AdalResultWrapper() + { + Exception = Exception, + RawClientInfo = RawClientInfo, + RefreshToken = RefreshToken, + ResourceInResponse = ResourceInResponse, + UserAssertionHash = UserAssertionHash, + Result = Result.Clone() + }; } } }