File size: 3,092 Bytes
7b715bc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | @using System.Security.Claims;
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Google.Apis.Auth.AspNetCore3 sample - Index</title>
</head>
<body>
<h2>Google.Apis.Auth.AspNetCore3 sample - Index</h2>
<p>The following links showcase some of the features provided by Google.Apis.Auth.AspNetCore3</p>
<br />
@if (User.Identity.IsAuthenticated)
{
<p><a asp-controller="home" asp-action="logout">Logout</a> - You are currently logged in as @User.FindFirst(ClaimTypes.GivenName)?.Value.</p>
}
else
{
<p><a asp-controller="home" asp-action="login">Login</a> - You are not currently logged in.</p>
}
<p>
<a asp-controller="home" asp-action="scopelisting">List current scopes</a> - List all scopes
this application is currently authorized for.
<ul>
<li>Authentication will trigger if there's no authenticated user.</li>
<li>This shows how to require authentication without any specific scopes.</li>
</ul>
</p>
<p>
<a asp-controller="home" asp-action="drivefilelist">List Google Drive files</a> - Use the Google Drive API to list some of the files
that the logged user owns.
<ul>
<li>Authentication will trigger if there's no authenticated user.</li>
<li>If a user is already authenticated but hasn't granted the required scopes, incremental authorization will trigger.</li>
<li>This shows how to do incremental authorization via attributes, and how to use the user's credential to access a Google API.</li>
</ul>
</p>
<p>
<a asp-controller="home" asp-action="calendarlist">List Calendars</a> - Use the Calendar API to list some of the calendars
that the logged user has access to.
<ul>
<li>Authentication will trigger if there's no authenticated user.</li>
<li>If a user is already authenticated but hasn't granted the required scopes, incremental authorization will trigger.</li>
<li>This shows how to do incremental authorization via code, and how to use the user's credential to access a Google API.</li>
</ul>
</p>
<p>
<a asp-controller="home" asp-action="showtokens">Show OAuth tokens related information</a>
<ul>
<li>Authentication will trigger if there's no authenticated user.</li>
<li>This shows how to inspect OAuth token related information.</li>
</ul>
</p>
<p>
<a asp-controller="home" asp-action="forcetokenrefresh">Force access token refresh</a>
<ul>
<li>Authentication will trigger if there's no authenticated user.</li>
<li>This shows how to force OAuth access token refresh.
You usually don't need to do this since Google.Apis.Auth.AspNetCore3 will
automatically refresh the access token when it's close to expiry.</li>
</ul>
</p>
</body>
</html>
|