yavsc/src/sampleWebAsWebApiClient/Views/Home/Index.cshtml
2024-11-12 08:32:15 +00:00

60 lines
1.6 KiB
Text
Executable file

@using Microsoft.AspNetCore.Authentication
@{
ViewData["Title"] = "Home Page";
}
<div class="jumbotron">
@if (User?.Identity?.IsAuthenticated ?? false) {
<h1>Welcome, @User.Identity.Name</h1>
<p>
@foreach (var claim in Context.User.Claims) {
<div>@claim.Type: <b>@claim.Value</b></div>
}
</p>
if (Model!=null) {
<h3>Message received from the resource controller: @Model</h3>
}
<form action="~/Home/GetUserInfo" method="post">
<button class="btn btn-lg btn-warning" type="submit">Get user info</button>
</form>
<form action="~/Home/PostDeviceInfo" method="post">
<button class="btn btn-lg btn-warning" type="submit">Post device info</button>
</form>
<form action="~/Home/PostFiles/?subdir=test" method="post" enctype="multipart/form-data">
Envoyer vers le dossier &quot;test&quot; <input type="file" name="file" multiple/>
<button class="btn btn-lg btn-warning" type="submit">Post files</button>
</form>
<a class="btn btn-lg btn-danger" href="/signout">Sign out</a>
}
else {
<h1>Welcome, anonymous</h1>
<a class="btn btn-lg btn-success" href="/signin">Sign in</a>
}
</div>
<h2>Claims</h2>
<dl>
@foreach (var claim in User.Claims)
{
<dt>@claim.Type</dt>
<dd>@claim.Value</dd>
}
</dl>
<h2>Properties</h2>
<dl>
@foreach (var prop in (await Context.AuthenticateAsync()).Properties.Items)
{
<dt>@prop.Key</dt>
<dd>@prop.Value</dd>
}
</dl>