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

Remove a few allocations for interfaces, which are not needed #2414

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void ReplyForbiddenWithWwwAuthenticateHeader(
+ $"&response_type=code&redirect_uri={application.AppConfig.RedirectUri}"
+ $"&response_mode=query&scope=offline_access%20{string.Join("%20", scopes)}";

IDictionary<string, string> parameters = new Dictionary<string, string>()
Dictionary<string, string> parameters = new()
{
{ Constants.ConsentUrl, consentUrl },
{ Constants.Claims, msalServiceException.Claims },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class OAuthConstants
#endif
protected readonly IMsalTokenCacheProvider _tokenCacheProvider;

private readonly object _applicationSyncObj = new object();
private readonly object _applicationSyncObj = new();

/// <summary>
/// Please call GetOrBuildConfidentialClientApplication instead of accessing this field directly.
/// </summary>
private ConcurrentDictionary<string, IConfidentialClientApplication?> _applicationsByAuthorityClientId = new ConcurrentDictionary<string, IConfidentialClientApplication?>();
private readonly ConcurrentDictionary<string, IConfidentialClientApplication?> _applicationsByAuthorityClientId = new ConcurrentDictionary<string, IConfidentialClientApplication?>();
private bool _retryClientCertificate;
protected readonly IMsalHttpClientFactory _httpClientFactory;
protected readonly ILogger _logger;
Expand Down Expand Up @@ -558,8 +558,7 @@ private bool IsInvalidClientCertificateOrSignedAssertionError(MsalServiceExcepti
internal /* for testing */ IConfidentialClientApplication GetOrBuildConfidentialClientApplication(
MergedOptions mergedOptions)
{
IConfidentialClientApplication? application;
if (!_applicationsByAuthorityClientId.TryGetValue(GetApplicationKey(mergedOptions), out application) || application == null)
if (!_applicationsByAuthorityClientId.TryGetValue(GetApplicationKey(mergedOptions), out IConfidentialClientApplication? application) || application == null)
{
lock (_applicationSyncObj)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ internal class AzureADB2COpenIDConnectEventHandlers
{
private readonly ILoginErrorAccessor _errorAccessor;

private readonly IDictionary<string, string> _userFlowToIssuerAddress =
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
private readonly Dictionary<string, string> _userFlowToIssuerAddress =
new(StringComparer.OrdinalIgnoreCase);

public AzureADB2COpenIDConnectEventHandlers(
string schemeName,
Expand Down