@using System.Security.Claims @using Microsoft.Owin @using Microsoft.Owin.Security @using Microsoft.Owin.Security.Cookies @using OpenIddict.Abstractions @using OpenIddict.Client.Owin @using OpenIddict.Sandbox.AspNet.Client.ViewModels.Home; @model IndexViewModel
@if (User?.Identity is { IsAuthenticated: true }) {

Welcome, @User.Identity.Name

@foreach (var claim in ((ClaimsPrincipal) Context.User).Claims) {

@claim.Type: @claim.Value
}

if (!string.IsNullOrEmpty(Model.Message)) {

Payload returned by the controller: @Model.Message

} if (User is ClaimsPrincipal principal && principal.FindFirst(OpenIddictConstants.Claims.Private.ProviderName)?.Value is "Local") {
@Html.AntiForgeryToken()
} if (Context.GetOwinContext() is IOwinContext context && context.Authentication.AuthenticateAsync(CookieAuthenticationDefaults.AuthenticationType).Result is AuthenticateResult result && result.Properties.Dictionary.ContainsKey(OpenIddictClientOwinConstants.Tokens.RefreshToken)) {
@Html.AntiForgeryToken()
}
@Html.AntiForgeryToken()
} else {

Welcome, anonymous

@Html.AntiForgeryToken() @foreach (var provider in Model.Providers) { }
}