Skip to content

Instantly share code, notes, and snippets.

View FacileTechnolab's full-sized avatar
:octocat:
happy to help

FacileTechnolab FacileTechnolab

:octocat:
happy to help
View GitHub Profile
@FacileTechnolab
FacileTechnolab / docker-compose.yml
Created February 27, 2020 06:58
Setting up docker instance of Elastichsearch, Kibana and Logstash on your local machine
version: '3.3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:latest
ports:
- "9200:9200"
- "9300:9300"
configs:
@FacileTechnolab
FacileTechnolab / NavMenu.razor
Created January 16, 2024 10:11
BlazorAppPart3
@using Microsoft.Extensions.Localization
@using System.Globalization
@inject IStringLocalizer<BlazorAppPart3.Locales.AppResources> localizer
<div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid">
<a class="navbar-brand" href="">BlazorAppPart3</a>
</div>
</div>
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)
{
@using System.Globalization
@inject NavigationManager Navigation
<div>
<select @bind="Culture">
<option value="en-US">English</option>
<option value="es-ES">Spanish</option>
</select>
</div>
@FacileTechnolab
FacileTechnolab / Program.cs
Created January 16, 2024 08:43
BlazorAppPart3/Program.cs
using BlazorAppPart3.Components;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddLocalization();
builder.Services.AddControllers();
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
@FacileTechnolab
FacileTechnolab / Program.cs
Last active December 22, 2023 11:40
BlazorAppPart2/Program.cs
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 =>
@FacileTechnolab
FacileTechnolab / appsettings.json
Created December 22, 2023 11:07
Entra ID Settings
"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"
},
@FacileTechnolab
FacileTechnolab / MainLayout.razor
Created December 22, 2023 10:55
Login and Logout links
<!-- 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>
@FacileTechnolab
FacileTechnolab / NugetPackageManager
Created December 22, 2023 07:07
BlazorAppPart2-NugetPackages
install-package microsoft.identity.web
install-package microsoft.identity.web.ui
"JwtKey": "a-very-long-radonmly-generated-secret-key-that-cannot-be-guessed",
"JwtIssuer": "https://localhost:44394", //replace this with your application url
"JwtExpireDays": 30,