Skip to content

Commit

Permalink
code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Aug 29, 2024
1 parent 4c5f909 commit ecb225f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public LogoutSessionManager(ILoggerFactory loggerFactory, IDistributedCache cach
_logger = loggerFactory.CreateLogger<LogoutSessionManager>();
}

public void Add(string sub, string sid)
public void Add(string? sub, string? sid)
{
_logger.LogWarning("BC Add a logout to the session: sub: {sub}, sid: {sid}", sub, sid);
var options = new DistributedCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromDays(cacheExpirationInDays));
Expand Down
4 changes: 2 additions & 2 deletions MvcHybridBackChannel/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public async Task<IActionResult> RenewTokens()
tokens.Add(new AuthenticationToken { Name = "expires_at", Value = expiresAt.ToString("o", CultureInfo.InvariantCulture) });

var info = await HttpContext.AuthenticateAsync("Cookies");
info.Properties.StoreTokens(tokens);
await HttpContext.SignInAsync("Cookies", info.Principal, info.Properties);
info.Properties!.StoreTokens(tokens);
await HttpContext.SignInAsync("Cookies", info.Principal!, info.Properties);

return Redirect("~/Home/Secure");
}
Expand Down
2 changes: 1 addition & 1 deletion MvcHybridBackChannel/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</button>
<div class="collapse navbar-collapse" id="topNavbarCollapse">
<ul class="mr-auto navbar-nav">
@if (User.Identity.IsAuthenticated)
@if (User.Identity!.IsAuthenticated)
{
<li class="nav-item">
<a asp-controller="Home" asp-action="Logout" class="nav-link">Logout</a>
Expand Down
2 changes: 1 addition & 1 deletion MvcHybridBackChannelTwo/Views/Home/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<br />

@if (User.Identity.IsAuthenticated)
@if (User.Identity!.IsAuthenticated)
{
<h1>Logged in as: @User.Identity.Name</h1>
}
Expand Down

0 comments on commit ecb225f

Please sign in to comment.