Skip to content

Commit

Permalink
Merge pull request #1731 from maartenba/ca
Browse files Browse the repository at this point in the history
Fix two potential NREs
  • Loading branch information
maartenba authored Jan 24, 2025
2 parents be615f8 + cd0884e commit 1c4e8fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void PostConfigure(string name, CookieAuthenticationOptions options)

IdentityServerLicenseValidator.Instance.ValidateServerSideSessions();
var licenseUsage = _httpContextAccessor.HttpContext?.RequestServices.GetRequiredService<LicenseUsageTracker>();
licenseUsage.FeatureUsed(LicenseFeature.ServerSideSessions);
licenseUsage?.FeatureUsed(LicenseFeature.ServerSideSessions);

var sessionStore = _httpContextAccessor.HttpContext!.RequestServices.GetService<IServerSideSessionStore>();
if (sessionStore is InMemoryServerSideSessionStore)
Expand Down Expand Up @@ -128,4 +128,4 @@ public Task<string> StoreAsync(AuthenticationTicket ticket)
{
return Inner.StoreAsync(ticket);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void RemoveCacheEntry(IdentityProvider idp)
var optionsMonitorType = typeof(IOptionsMonitorCache<>).MakeGenericType(provider.OptionsType);
// need to resolve the provide type dynamically, thus the need for the http context accessor
// this will throw if attempted outside an http request, but that is checked in the caller
var optionsCache = _httpContextAccessor.HttpContext.RequestServices.GetService(optionsMonitorType);
var optionsCache = _httpContextAccessor.HttpContext?.RequestServices.GetService(optionsMonitorType);
if (optionsCache != null)
{
var mi = optionsMonitorType.GetMethod("TryRemove");
Expand All @@ -113,4 +113,4 @@ void RemoveCacheEntry(IdentityProvider idp)
}
}
}
}
}

0 comments on commit 1c4e8fb

Please sign in to comment.