Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .NET 6 target that uses System.Text.Json and IL trimming #3605

Merged
merged 42 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
3735d76
Add Net6 target
pmaytak Aug 15, 2022
e471e30
Merge remote-tracking branch 'origin/main' into pmaytak/system-text-json
pmaytak Aug 15, 2022
659426a
Merge JsonUtil.cs into JsonHelper.cs.
pmaytak Aug 15, 2022
ef71371
Add back UIAutomation project.
pmaytak Aug 15, 2022
14b19a4
Remove json folder for net6
pmaytak Aug 15, 2022
091057e
Work.
pmaytak Aug 17, 2022
c2e78c9
Merge remote-tracking branch 'origin/main' into pmaytak/system-text-json
pmaytak Aug 17, 2022
5953914
Work.
pmaytak Aug 17, 2022
987b7c0
Work.
pmaytak Aug 18, 2022
60a9c8b
Work.
pmaytak Aug 18, 2022
4332c1f
Work.
pmaytak Aug 18, 2022
75b2a8c
Work.
pmaytak Aug 18, 2022
6bc3a55
Merge remote-tracking branch 'origin/main' into pmaytak/system-text-json
pmaytak Aug 18, 2022
afd3f4b
Fix bug.
pmaytak Aug 22, 2022
6154480
Add net6 target to unit tests, exclude broker tests on net6.
pmaytak Aug 23, 2022
d33f1aa
In unit tests on Net6 use Newtonsoft instead of internal Json.Net whe…
pmaytak Aug 23, 2022
e1ce0c6
Remove reference to some non-existing IAccountInternal class.
pmaytak Aug 23, 2022
3d46118
More test fixes.
pmaytak Aug 23, 2022
e50f720
Add Net6 target to perf test project.
pmaytak Aug 23, 2022
584ddaf
Merge origin/main.
pmaytak Aug 23, 2022
efe3e61
Bug fix.
pmaytak Aug 23, 2022
1290239
Use Net6 instead of NetCore3.1 for integration tests.
pmaytak Aug 23, 2022
7816c5a
Dismiss warning that NetCore2.1 is obsolete.
pmaytak Aug 23, 2022
768a971
Merge remote-tracking branch 'origin/main' into pmaytak/system-text-json
pmaytak Aug 23, 2022
24590bb
Remove reference to StrongNamer, fix snk path.
pmaytak Aug 23, 2022
105092b
Revert "Remove reference to StrongNamer, fix snk path."
pmaytak Aug 24, 2022
07e4b19
Integration.NetCore only targets net6. Comment out ATI broker.
pmaytak Aug 24, 2022
00c8e2a
Revert target frameworks.
pmaytak Aug 24, 2022
31cac42
Target perf project only to net6
pmaytak Aug 24, 2022
bdb7e8e
Remove JsonInclude and internal sets on public properties in internal…
pmaytak Aug 24, 2022
99b79ab
Reuse JsonSerializerOptions.
pmaytak Aug 24, 2022
8aa40e1
Remove StrongNamer from IntegrationTestsNetCore.
pmaytak Aug 24, 2022
68c9568
Set perf project to netcore3.1.
pmaytak Aug 24, 2022
d0506bb
Cetralized code for enumeration
SameerK-MSFT Aug 26, 2022
087b3a2
Use dummy JsonObjectAttribute on Net6, add comments.
pmaytak Aug 27, 2022
b8f1981
Merge branch 'pmaytak/system-text-json' of https://github.com/AzureAD…
pmaytak Aug 27, 2022
4352135
Merge remote-tracking branch 'origin/main' into pmaytak/system-text-json
pmaytak Aug 27, 2022
7b921d1
Use SUPPORTS_SYSTEM_TEXT_JSON instead of NET6_0_OR_GREATER. Move net6…
pmaytak Aug 27, 2022
ad5ddc7
Add Newtonsoft flags to Net6-maui targets.
pmaytak Sep 1, 2022
fa9b9a1
Merge remote-tracking branch 'origin/main' into pmaytak/system-text-json
pmaytak Sep 1, 2022
08f2886
Merge main.
pmaytak Sep 2, 2022
5171456
Disable iOS tests.
pmaytak Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions LibsAndSamples.sln
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IntuneMAMSampleiOS", "tests
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TrueMam", "TrueMam", "{660867D0-956C-4AF2-8627-03AADF4FCEAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Identity.Test.UIAutomation.Infrastructure", "tests\Microsoft.Identity.Test.Core.UIAutomation\Microsoft.Identity.Test.UIAutomation.Infrastructure.csproj", "{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}"
bgavrilMS marked this conversation as resolved.
Show resolved Hide resolved
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug + MobileApps|Any CPU = Debug + MobileApps|Any CPU
Expand Down Expand Up @@ -2310,6 +2312,48 @@ Global
{034A5B86-A8AE-449D-B561-46F811329E6D}.Release|x64.Build.0 = Release|iPhoneSimulator
{034A5B86-A8AE-449D-B561-46F811329E6D}.Release|x86.ActiveCfg = Release|iPhoneSimulator
{034A5B86-A8AE-449D-B561-46F811329E6D}.Release|x86.Build.0 = Release|iPhoneSimulator
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|Any CPU.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|Any CPU.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|ARM.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|ARM.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|ARM64.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|ARM64.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|iPhone.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|iPhone.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|iPhoneSimulator.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|x64.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|x64.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|x86.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug + MobileApps|x86.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|ARM.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|ARM.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|ARM64.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|iPhone.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|x64.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|x64.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|x86.ActiveCfg = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Debug|x86.Build.0 = Debug|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|Any CPU.Build.0 = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|ARM.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|ARM.Build.0 = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|ARM64.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|ARM64.Build.0 = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|iPhone.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|iPhone.Build.0 = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|x64.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|x64.Build.0 = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|x86.ActiveCfg = Release|Any CPU
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -2373,6 +2417,7 @@ Global
{69CE42A2-44DD-4740-856B-607C3BB5A92E} = {9B0B5396-4D95-4C15-82ED-DC22B5A3123F}
{034A5B86-A8AE-449D-B561-46F811329E6D} = {660867D0-956C-4AF2-8627-03AADF4FCEAA}
{660867D0-956C-4AF2-8627-03AADF4FCEAA} = {34BE693E-3496-45A4-B1D2-D3A0E068EEDB}
{3DC6EC76-D350-4D43-B206-A4CEC8AA36D4} = {45EBC624-6277-4EA2-A89C-A730A3214503}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {020399A9-DC27-4B82-9CAA-EF488665AC27}
Expand Down
3 changes: 3 additions & 0 deletions build/platform_and_feature_flags.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<PropertyGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkNetCore)' ">
<DefineConstants>$(DefineConstants);NET_CORE;SUPPORTS_CONFIDENTIAL_CLIENT;SUPPORTS_CUSTOM_CACHE;SUPPORTS_BROKER;SUPPORTS_WIN32;</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkNet6)' ">
<DefineConstants>$(DefineConstants);NET_CORE;SUPPORTS_CONFIDENTIAL_CLIENT;SUPPORTS_CUSTOM_CACHE;SUPPORTS_BROKER;SUPPORTS_WIN32;</DefineConstants>
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == '$(TargetFrameworkNet5Win)' ">
<DefineConstants>$(DefineConstants);NET5_WIN;SUPPORTS_CONFIDENTIAL_CLIENT;SUPPORTS_CUSTOM_CACHE;SUPPORTS_BROKER;SUPPORTS_WIN32;</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
using Microsoft.Identity.Client.Http;
using Microsoft.Identity.Client.Instance;
using Microsoft.Identity.Client.Instance.Discovery;
using Microsoft.Identity.Client.Internal;
using Microsoft.Identity.Client.PlatformsCommon.Interfaces;
using Microsoft.Identity.Client.Utils;
using Microsoft.Identity.Json;
using Microsoft.IdentityModel.Abstractions;
#if NET6_0_OR_GREATER
using System.Text.Json;
#else
using Microsoft.Identity.Json;
#endif

namespace Microsoft.Identity.Client
{
Expand Down Expand Up @@ -555,18 +558,17 @@ internal void ValidateUseOfExperimentalFeature([System.Runtime.CompilerServices.
}
}


#region Authority
private void ResolveAuthority()
{
if (Config.Authority?.AuthorityInfo != null)
{
var isB2C = Config.Authority is B2CAuthority;

AadAuthority aadAuthority = Config.Authority as AadAuthority;
if (!string.IsNullOrEmpty(Config.TenantId)
if (!string.IsNullOrEmpty(Config.TenantId)
&& !isB2C
&& aadAuthority != null )
&& aadAuthority != null)
{
if (!aadAuthority.IsCommonOrganizationsOrConsumersTenant() &&
!string.Equals(aadAuthority.TenantId, Config.TenantId))
Expand Down Expand Up @@ -854,7 +856,7 @@ public T WithB2CAuthority(string authorityUri)
return (T)this;
}

#endregion
#endregion

private static string GetValueIfNotEmpty(string original, string value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
using System.ComponentModel;
using System.Diagnostics;
using Microsoft.Identity.Client.Utils;
using Microsoft.Identity.Json;
#if NET6_0_OR_GREATER
using JObject = System.Text.Json.Nodes.JsonObject;
#else
using Microsoft.Identity.Json.Linq;
#endif

namespace Microsoft.Identity.Client
{
Expand Down Expand Up @@ -46,29 +49,29 @@ public TraceTelemetryConfig()
/// <remarks>This API is experimental and it may change in future versions of the library without an major version increment</remarks>
public Action<ITelemetryEventPayload> DispatchAction => payload =>
{
var j = new JObject();
var jsonObject = new JObject();
foreach (var kvp in payload.BoolValues)
{
j[kvp.Key] = kvp.Value;
jsonObject[kvp.Key] = kvp.Value;
}
foreach (var kvp in payload.IntValues)
{
j[kvp.Key] = kvp.Value;
jsonObject[kvp.Key] = kvp.Value;
}
foreach (var kvp in payload.Int64Values)
{
j[kvp.Key] = kvp.Value;
jsonObject[kvp.Key] = kvp.Value;
}
foreach (var kvp in payload.StringValues)
{
j[kvp.Key] = kvp.Value;
jsonObject[kvp.Key] = kvp.Value;
}

string msg = JsonConvert.SerializeObject(j, Formatting.None);
string message = JsonHelper.JsonObjectToString(jsonObject);
#if WINDOWS_APP
Debug.WriteLine(msg);
Debug.WriteLine(message);
#else
Trace.TraceInformation(msg);
Trace.TraceInformation(message);
Trace.Flush();
#endif
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@
using Microsoft.Identity.Client.Internal;
using Microsoft.Identity.Client.OAuth2;
using Microsoft.Identity.Client.Utils;
#if NET6_0_OR_GREATER
using JObject = System.Text.Json.Nodes.JsonObject;
using JToken = System.Text.Json.Nodes.JsonNode;
#else
using Microsoft.Identity.Json;
using Microsoft.Identity.Json.Linq;
#endif

namespace Microsoft.Identity.Client.AuthScheme.PoP
{
internal class PopAuthenticationScheme : IAuthenticationScheme
{
private static readonly DateTime s_jwtBaselineTime = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
private readonly PoPAuthenticationConfiguration _popAuthenticationConfiguration;
private IPoPCryptoProvider _popCryptoProvider;
private readonly IPoPCryptoProvider _popCryptoProvider;

/// <summary>
/// Creates POP tokens, i.e. tokens that are bound to an HTTP request and are digitally signed.
Expand Down Expand Up @@ -68,48 +73,48 @@ public string FormatAccessToken(MsalAccessTokenCacheItem msalAccessTokenCacheIte
return msalAccessTokenCacheItem.Secret;
}

JObject header = new JObject
{
{ JsonWebTokenConstants.ReservedHeaderParameters.Algorithm, _popCryptoProvider.CryptographicAlgorithm },
{ JsonWebTokenConstants.ReservedHeaderParameters.KeyId, KeyId },
{ JsonWebTokenConstants.ReservedHeaderParameters.Type, Constants.PoPTokenType}
};
var header = new JObject();
header[JsonWebTokenConstants.ReservedHeaderParameters.Algorithm] = _popCryptoProvider.CryptographicAlgorithm;
header[JsonWebTokenConstants.ReservedHeaderParameters.KeyId] = KeyId;
header[JsonWebTokenConstants.ReservedHeaderParameters.Type] = Constants.PoPTokenType;

JObject body = CreateBody(msalAccessTokenCacheItem);
var body = CreateBody(msalAccessTokenCacheItem);

string popToken = CreateJWS(body.ToString(Formatting.None), header.ToString(Formatting.None));
string popToken = CreateJWS(JsonHelper.JsonObjectToString(body), JsonHelper.JsonObjectToString(header));
return popToken;
}

private JObject CreateBody(MsalAccessTokenCacheItem msalAccessTokenCacheItem)
{
JToken publicKeyJWK = JToken.Parse(_popCryptoProvider.CannonicalPublicKeyJwk);
List<JProperty> properties = new List<JProperty>(8);

// Mandatory parameters
properties.Add(new JProperty(PoPClaimTypes.Cnf, new JObject(new JProperty(PoPClaimTypes.JWK, publicKeyJWK))));
properties.Add(new JProperty(PoPClaimTypes.Ts, DateTimeHelpers.CurrDateTimeInUnixTimestamp()));
properties.Add(new JProperty(PoPClaimTypes.At, msalAccessTokenCacheItem.Secret));
properties.Add(new JProperty(PoPClaimTypes.Nonce, _popAuthenticationConfiguration.Nonce ?? CreateSimpleNonce()));
var publicKeyJwk = JToken.Parse(_popCryptoProvider.CannonicalPublicKeyJwk);
var body = new JObject
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
{
// Mandatory parameters
[PoPClaimTypes.Cnf] = new JObject
{
[PoPClaimTypes.JWK] = publicKeyJwk
},
[PoPClaimTypes.Ts] = DateTimeHelpers.CurrDateTimeInUnixTimestamp(),
[PoPClaimTypes.At] = msalAccessTokenCacheItem.Secret,
[PoPClaimTypes.Nonce] = _popAuthenticationConfiguration.Nonce ?? CreateSimpleNonce(),
};

if (_popAuthenticationConfiguration.HttpMethod != null)
{
properties.Add(new JProperty(PoPClaimTypes.HttpMethod, _popAuthenticationConfiguration.HttpMethod?.ToString()));
body[PoPClaimTypes.HttpMethod] = _popAuthenticationConfiguration.HttpMethod?.ToString();
}

if (!string.IsNullOrEmpty(_popAuthenticationConfiguration.HttpHost))
{
properties.Add(new JProperty(PoPClaimTypes.Host, _popAuthenticationConfiguration.HttpHost));
body[PoPClaimTypes.Host] = _popAuthenticationConfiguration.HttpHost;
}

if (!string.IsNullOrEmpty(_popAuthenticationConfiguration.HttpPath))
{
properties.Add(new JProperty(PoPClaimTypes.Path, _popAuthenticationConfiguration.HttpPath));
body[PoPClaimTypes.Path] = _popAuthenticationConfiguration.HttpPath;
}

var payload = new JObject(properties);

return payload;
return body;
}

private static string CreateSimpleNonce()
Expand Down
13 changes: 9 additions & 4 deletions src/client/Microsoft.Identity.Client/Cache/Adal/AdalResult.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
#if NET6_0_OR_GREATER
using JsonProperty = System.Text.Json.Serialization.JsonIncludeAttribute;
#else
using Microsoft.Identity.Json;
#endif

namespace Microsoft.Identity.Client.Cache
{
/// <summary>
/// Contains the results of an ADAL token acquisition. Access Tokens from ADAL are not compatible
/// with MSAL, only Refresh Tokens are.
/// </summary>
#if !NET6_0_OR_GREATER
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
[JsonObject]
#endif
[Preserve(AllMembers = true)]
internal sealed class AdalResult
{
internal AdalResult()
{
public AdalResult()
{
// for serialization
}
}

/// <summary>
/// Gets user information including user Id. Some elements in UserInfo might be null if not returned by the service.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using Microsoft.Identity.Client.Utils;
pmaytak marked this conversation as resolved.
Show resolved Hide resolved
#if !NET6_0_OR_GREATER
using Microsoft.Identity.Json;
#endif

namespace Microsoft.Identity.Client.Cache
{
#if !NET6_0_OR_GREATER
[JsonObject]
#endif
[Preserve(AllMembers = true)]
internal class AdalResultWrapper
{

#if !NET6_0_OR_GREATER
[JsonProperty]
#endif
public AdalResult Result { get; set; }

#if !NET6_0_OR_GREATER
[JsonProperty]
#endif
public string RawClientInfo { get; set; }

/// <summary>
/// Gets the Refresh Token associated with the requested Access Token. Note: not all operations will return a Refresh Token.
/// </summary>
#if !NET6_0_OR_GREATER
[JsonProperty]
#endif
public string RefreshToken { get; set; }

/// <summary>
Expand All @@ -30,7 +40,9 @@ internal class AdalResultWrapper

// This is only needed for AcquireTokenByAuthorizationCode in which parameter resource is optional and we need
// to get it from the STS response.
#if !NET6_0_OR_GREATER
[JsonProperty]
#endif
internal string ResourceInResponse { get; set; }

/// <summary>
Expand All @@ -51,9 +63,9 @@ public string Serialize()
return JsonHelper.SerializeToJson(this);
}

internal Exception Exception { get; set; }

#if !NET6_0_OR_GREATER
[JsonProperty]
#endif
public string UserAssertionHash { get; set; }

internal AdalResultWrapper Clone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@
// Licensed under the MIT License.

using System;
#if NET6_0_OR_GREATER
using JsonProperty = System.Text.Json.Serialization.JsonIncludeAttribute;
#else
using Microsoft.Identity.Json;
#endif

namespace Microsoft.Identity.Client.Cache
{
/// <summary>
/// Contains information of a single user. This information is used for token cache lookup. Also if created with userId, userId is sent to the service when login_hint is accepted.
/// </summary>
#if !NET6_0_OR_GREATER
[JsonObject]
#endif
[Preserve(AllMembers = true)]
internal sealed class AdalUserInfo
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// Licensed under the MIT License.

using System.Collections.Generic;
#if NET6_0_OR_GREATER
using JToken = System.Text.Json.Nodes.JsonNode;
#else
using Microsoft.Identity.Json.Linq;
#endif

namespace Microsoft.Identity.Client.Cache
{
Expand Down
Loading