This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:latest | |
ports: | |
- "9200:9200" | |
- "9300:9300" | |
configs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Localization; | |
using Microsoft.AspNetCore.Mvc; | |
namespace BlazorAppPart3.Controllers | |
{ | |
[Route("[controller]/[action]")] | |
public class CultureController : Controller | |
{ | |
public IActionResult Set(string culture, string redirectUri) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using System.Globalization | |
@inject NavigationManager Navigation | |
<div> | |
<select @bind="Culture"> | |
<option value="en-US">English</option> | |
<option value="es-ES">Spanish</option> | |
</select> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BlazorAppPart3.Components; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddLocalization(); | |
builder.Services.AddControllers(); | |
// Add services to the container. | |
builder.Services.AddRazorComponents() | |
.AddInteractiveServerComponents(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using BlazorAppPart2.Components; | |
using Microsoft.AspNetCore.Authorization; | |
using Microsoft.AspNetCore.Mvc.Authorization; | |
using Microsoft.Identity.Web; | |
using Microsoft.Identity.Web.UI; | |
var builder = WebApplication.CreateBuilder(args); | |
builder.Services.AddMicrosoftIdentityWebAppAuthentication(builder.Configuration); | |
builder.Services.AddHttpContextAccessor(); | |
builder.Services.AddControllersWithViews(options => |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"AzureAd": { | |
"Instance": "https://login.microsoftonline.com/", | |
"TenantId": "Directory (tenant) ID from Registered Azure App", | |
"ClientId": "Application (client) ID from Registered Azure App", | |
"Domain": "customDomain.onmicrosoft.com", //Application ID URI without Application (client) ID and https | |
"CallbackPath": "/signin-oidc" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Add @using Microsoft.AspNetCore.Components.Authorization at the top--> | |
<CascadingAuthenticationState> | |
<AuthorizeView> | |
<Authorized> | |
<a asp-controller="Home" asp-action="Index">Welcome @context.User.Identity?.Name!</a> | |
<a href="MicrosoftIdentity/Account/SignOut">Logout</a> | |
</Authorized> | |
<NotAuthorized> | |
<a href="MicrosoftIdentity/Account/SignIn">Login</a> | |
</NotAuthorized> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install-package microsoft.identity.web | |
install-package microsoft.identity.web.ui |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"JwtKey": "a-very-long-radonmly-generated-secret-key-that-cannot-be-guessed", | |
"JwtIssuer": "https://localhost:44394", //replace this with your application url | |
"JwtExpireDays": 30, |
NewerOlder