Skip to content

Instantly share code, notes, and snippets.

View PawelHaracz's full-sized avatar

Paweł Haracz PawelHaracz

View GitHub Profile
using Microsoft.Extensions.Options;
using Structurizr;
using Structurizr.Api;
namespace model.c4
{
public class C4Generator
{
private readonly Options.Structurizr _options;
private const string MicroserviceTag = "Microservice";
<!DOCTYPE html>
<html lang="en">
<head>
<title>Serverless Authentication</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<!-- Latest compiled and minified CSS -->

Merry Christmas and a Happy New Year!

I hope you will finish #25daysofserverless !!

@PawelHaracz
PawelHaracz / AsyncHelper.cs
Last active June 5, 2019 10:11
the validator checks whitelist and decodes token and compare this with appId claim. An AsyncHelper invoke asynchronous method synchronously. A startup class is a normal .net core startup class
// Copyright (c) Microsoft Corporation, Inc. All rights reserved.
// Licensed under the MIT License, Version 2.0. See License.txt in the project root for license information.
/// <summary>
/// Helper created by microsoft
/// https://github.com/aspnet/AspNetIdentity/blob/master/src/Microsoft.AspNet.Identity.Core/AsyncHelper.cs
/// </summary>
public class AsyncHelper
{
@PawelHaracz
PawelHaracz / AsyncHelper.cs
Created June 5, 2019 09:35
the validator checks whitelist and decodes token and compare this with appId claim;
public class AsyncHelper
{
private static readonly TaskFactory _myTaskFactory = new TaskFactory(CancellationToken.None,
TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler.Default);
public static TResult RunSync<TResult>(Func<Task<TResult>> func)
{
var cultureUi = CultureInfo.CurrentUICulture;
var culture = CultureInfo.CurrentCulture;
return _myTaskFactory.StartNew(() =>
Invoke-AzureRmResourceAction -ResourceGroupName <your-resource-group> -ResourceType "Microsoft.Web/sites" -ResourceName <Your-Azure-Function> -Action syncfunctiontriggers -ApiVersion "2018-02-01" -Force
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"registryPassword": {
"type": "SecureString"
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /app
EXPOSE 80
# copy csproj and restore as distinct layers
COPY src/nuget.config ./src/
COPY src/*.sln ./src/
COPY src/Qbank.Questions/*.csproj ./src/Qbank.Questions/
COPY src/Qbank.Questions.WebApi/*.csproj ./src/Qbank.Questions.WebApi/
COPY test/Qbank.Questions.Test/*.csproj ./test/Qbank.Questions.Test/
@PawelHaracz
PawelHaracz / docker-dotnet-aspnet-https.md
Created September 3, 2018 14:03 — forked from richlander/docker-dotnet-aspnet-https.md
ASP.NET Core dotnet and docker commands for HTTPS
dotnet dev-certs https -ep %USERPROFILE%\.aspnet\https\aspnetapp.pfx -p crypticpassword
dotnet dev-certs https --trust
docker pull microsoft/dotnet-samples:aspnetapp
docker run --rm -it -p 8000:80 -p 8001:443 -e ASPNETCORE_URLS="https://+;http://+" -e ASPNETCORE_HTTPS_PORT=8001 -e ASPNETCORE_Kestrel__Certificates__Default__Password="crypticpassword" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v %USERPROFILE%\.aspnet\https:/https/ microsoft/dotnet-samples:aspnetapp