Skip to content

Commit

Permalink
Update index
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbod committed Nov 5, 2023
1 parent 64cae6f commit ee33bf0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions WebCodeFlowPkceClient/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
}

<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
@foreach (var claim in Model.Claims)
{
<div><b>@claim.Type</b> @claim.Value</div>
}
</div>
8 changes: 7 additions & 1 deletion WebCodeFlowPkceClient/Pages/Index.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Security.Claims;

namespace WebCodeFlowPkceClient.Pages;

Expand All @@ -13,8 +15,12 @@ public IndexModel(ILogger<IndexModel> logger)
_logger = logger;
}

[BindProperty]
public IEnumerable<Claim> Claims { get; set; } = Enumerable.Empty<Claim>();

public void OnGet()
{
var claims = User.Claims.ToList();
// var claims = User.Claims.ToList();
Claims = User.Claims;
}
}

0 comments on commit ee33bf0

Please sign in to comment.