Shows user's name & UPN while logged In

This commit is contained in:
Vazhin Tayeb 2021-01-19 13:36:43 +03:00
parent 07e31bed41
commit 0f9e0e3ee4
3 changed files with 43 additions and 16 deletions

View File

@ -30,6 +30,20 @@ namespace IdentityServerHost.Quickstart.UI
new Claim(JwtClaimTypes.Email, "muhammad-azeez@outlook.com"),
new Claim(JwtClaimTypes.EmailVerified, "true", ClaimValueTypes.Boolean),
},
},
new TestUser
{
SubjectId = "4990102438634",
Username = "4990102438634",
Password = "123",
Claims =
{
new Claim(JwtClaimTypes.Name, "Vazhin Tayeb"),
new Claim(JwtClaimTypes.GivenName, "Vazhin"),
new Claim(JwtClaimTypes.FamilyName, "Tayeb"),
new Claim(JwtClaimTypes.Email, "vazhintayeb@gmail.com"),
new Claim(JwtClaimTypes.EmailVerified, "true", ClaimValueTypes.Boolean),
},
}
};
}

View File

@ -6,10 +6,12 @@
}
<div class="logged-out-page">
<div>
<h1>
Logout
<small>You are now logged out</small>
</h1>
<h3 class="font-weight-light mt-3">You are now logged out</h3>
</div>
@if (Model.PostLogoutRedirectUri != null)
{

View File

@ -1,4 +1,5 @@
@using System.Diagnostics
@using IdentityServer4.Extensions
@{
var version =
@ -9,22 +10,32 @@
<div class="row justify-content-center align-items-center">
<div class="col-lg-6 col-md-8">
<div class="card p-5 justify-content-center">
@if (User.Identity.IsAuthenticated)
{
<h2 class="font-weight-normal">
Welcome @User.GetDisplayName()!
</h2>
<p class="mt-2">Your UPN is: @User.FindFirst("sub").Value</p>
<div>
<a class="btn btn-primary px-4 font-weight-bold mt-4" asp-controller="Account" asp-action="Logout"
role="button">Logout</a>
</div>
}
else
{
<h2 class="font-weight-normal">
Identity Server
</h2>
<p class="font-weight-normal mt-4" style="font-size: 20px;">This service is a centeralized
<p class="font-weight-light mt-4" style="font-size: 20px;">This service is a centeralized
authentication tool. It's used
for
all of the kurdistan's digital
services.
</p>
@if (User.Identity.IsAuthenticated == false)
{
<div>
<a class="btn btn-primary px-4 font-weight-bold mt-5" asp-controller="Diagnostics"
asp-action="Index" role="button">Login</a>
<a class="btn btn-primary px-4 font-weight-bold mt-4" asp-controller="Account" asp-action="Login"
role="button">Login</a>
</div>
}
</div>