5 | [Home] 6 |
7 | 8 | -------------------------------------------------------------------------------- /Exercises/Authentication.Roles/Views/Admin/Manager.cshtml: -------------------------------------------------------------------------------- 1 | 2 | IsAuthenticated : @User.Identity.IsAuthenticated 3 |
4 | 5 |6 | Name : @User.Identity.Name 7 |
-------------------------------------------------------------------------------- /Exercises/Authentication.Roles/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -------------------------------------------------------------------------------- /Exercises/Authentication.Roles/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Exercises/Authentication.Roles/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Exercises/Authorization.Basics/Authorization.Basics.csproj: -------------------------------------------------------------------------------- 1 |You are not authorized to access this resource.
13 | } 14 |Sorry, there's nothing at this address.
20 |Current count: @currentCount
8 | 9 | 10 | 11 | 12 | @code { 13 | private int currentCount = 0; 14 | 15 | private void IncrementCount() 16 | { 17 | currentCount++; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Exercises/Authorization.Blazor.WebAssembly/Pages/FetchData.razor: -------------------------------------------------------------------------------- 1 | @page "/fetchdata" 2 | @inject HttpClient Http 3 | 4 |This component demonstrates fetching data from the server.
7 | 8 | @if (forecasts == null) 9 | { 10 |Loading...
11 | } 12 | else 13 | { 14 |Date | 18 |Temp. (C) | 19 |Temp. (F) | 20 |Summary | 21 |
---|---|---|---|
@forecast.Date.ToShortDateString() | 28 |@forecast.TemperatureC | 29 |@forecast.TemperatureF | 30 |@forecast.Summary | 31 |
Program.cs
7 | 6 | We're gonna missing you! 7 |
-------------------------------------------------------------------------------- /Exercises/Authorization.Client.Mvc/Views/Site/Index.cshtml: -------------------------------------------------------------------------------- 1 | 5 | [Home] 6 |
7 | 8 | -------------------------------------------------------------------------------- /Exercises/Authorization.Database/Views/Admin/Manager.cshtml: -------------------------------------------------------------------------------- 1 | 2 | IsAuthenticated : @User.Identity.IsAuthenticated 3 |
4 | 5 |6 | Name : @User.Identity.Name 7 |
-------------------------------------------------------------------------------- /Exercises/Authorization.Database/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -------------------------------------------------------------------------------- /Exercises/Authorization.Database/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Exercises/Authorization.Database/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Exercises/Authorization.FacebookDemo/Authorization.FacebookDemo.csproj: -------------------------------------------------------------------------------- 1 |5 | [Home] 6 |
7 | 8 | 9 |
25 | You can use: User
26 | and password: 123qwe
27 |
2 | IsAuthenticated : @User.Identity.IsAuthenticated 3 |
4 | 5 |6 | Name : @User.Identity.Name 7 |
-------------------------------------------------------------------------------- /Exercises/Authorization.FacebookDemo/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -------------------------------------------------------------------------------- /Exercises/Authorization.FacebookDemo/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Exercises/Authorization.FacebookDemo/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "Authentication": { 11 | "Facebook": { 12 | "AppId": "xxxxxxxxxxxxxxxxxxxx", 13 | "AppSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 14 | } 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /Exercises/Authorization.IdentityServer/Account/AccountOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System; 6 | 7 | namespace Authorization.IdentityServer.Account 8 | { 9 | public class AccountOptions 10 | { 11 | public static bool AllowLocalLogin = true; 12 | public static bool AllowRememberLogin = true; 13 | public static TimeSpan RememberMeLoginDuration = TimeSpan.FromDays(30); 14 | 15 | public static bool ShowLogoutPrompt = true; 16 | public static bool AutomaticRedirectAfterSignOut = false; 17 | 18 | public static string InvalidCredentialsErrorMessage = "Invalid username or password"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Exercises/Authorization.IdentityServer/Account/ExternalProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace Authorization.IdentityServer.Account 6 | { 7 | public class ExternalProvider 8 | { 9 | public string DisplayName { get; set; } 10 | public string AuthenticationScheme { get; set; } 11 | } 12 | } -------------------------------------------------------------------------------- /Exercises/Authorization.IdentityServer/Account/LoggedOutViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | namespace Authorization.IdentityServer.Account 6 | { 7 | public class LoggedOutViewModel 8 | { 9 | public string PostLogoutRedirectUri { get; set; } 10 | public string ClientName { get; set; } 11 | public string SignOutIframeUrl { get; set; } 12 | 13 | public bool AutomaticRedirectAfterSignOut { get; set; } 14 | 15 | public string LogoutId { get; set; } 16 | public bool TriggerExternalSignout => ExternalAuthenticationScheme != null; 17 | public string ExternalAuthenticationScheme { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /Exercises/Authorization.IdentityServer/Account/LoginInputModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System.ComponentModel.DataAnnotations; 6 | 7 | namespace Authorization.IdentityServer.Account 8 | { 9 | public class LoginInputModel 10 | { 11 | [Required] 12 | public string Username { get; set; } 13 | [Required] 14 | public string Password { get; set; } 15 | public bool RememberLogin { get; set; } 16 | public string ReturnUrl { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Exercises/Authorization.IdentityServer/Account/LoginViewModel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Brock Allen & Dominick Baier. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. 3 | 4 | 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | 9 | namespace Authorization.IdentityServer.Account 10 | { 11 | public class LoginViewModel : LoginInputModel 12 | { 13 | public bool AllowRememberLogin { get; set; } = true; 14 | public bool EnableLocalLogin { get; set; } = true; 15 | 16 | public IEnumerableYou do not have access to that resource.
6 |Would you like to logut of IdentityServer?
7 |You have successfully authorized the device
6 |Please enter the code displayed on your device.
7 |Once complete, you may close this tab.
7 |10 | 11 | 12 | 13 | 14 |
15 |16 | 17 |
18 | 19 |6 | @ViewBag.Token 7 |-------------------------------------------------------------------------------- /Exercises/Authorization.JwtBearer/Views/Home/Index.cshtml: -------------------------------------------------------------------------------- 1 |
2 | Index 3 | Secret 4 | Authenticate 5 |
-------------------------------------------------------------------------------- /Exercises/Authorization.JwtBearer/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -------------------------------------------------------------------------------- /Exercises/Authorization.JwtBearer/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Exercises/Authorization.JwtBearer/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /Exercises/Authorization.Orders.Api/Authorization.Orders.Api.csproj: -------------------------------------------------------------------------------- 1 |8 | @ViewData["Message"] 9 |
10 | } -------------------------------------------------------------------------------- /Exercises/Authorization.Users.Api/Views/Site/Index.cshtml: -------------------------------------------------------------------------------- 1 | 5 | [Home] 6 |
7 | 8 | 9 |
25 | You can use: User
26 | and password: 123qwe
27 |
2 | IsAuthenticated : @User.Identity.IsAuthenticated 3 |
4 | 5 |6 | Name : @User.Identity.Name 7 |
-------------------------------------------------------------------------------- /Exercises/Authorization.VKontakte/Views/_ViewImports.cshtml: -------------------------------------------------------------------------------- 1 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers -------------------------------------------------------------------------------- /Exercises/Authorization.VKontakte/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Exercises/Authorization.VKontakte/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*", 10 | "Authentication": { 11 | "Facebook": { 12 | "AppId": "xxxxxxxxxxxxxxxxxxxx", 13 | "AppSecret": "xxxxxxxxxxxxxxxxxxxxxxxxx" 14 | }, 15 | "VK": { 16 | "AppId": "xxxxxxx", 17 | "AppSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Exercises/NuGet.Config: -------------------------------------------------------------------------------- 1 | 2 |