Skip to content

Instantly share code, notes, and snippets.

View kroymann's full-sized avatar

Dan Kroymann kroymann

View GitHub Profile
@kroymann
kroymann / AsyncKeyLock.cs
Last active August 13, 2019 15:12
Async locking infrastructure
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
namespace RecNet.Common.Synchronization
{
public class AsyncKeyLock<TKey> : IAsyncKeyLock<TKey>
{
#region Constants
@kroymann
kroymann / IdentityServerAzureKeyVault.cs
Last active October 15, 2024 15:24
This code extends IdentityServer4 so that the token signing credentials and validation keys can be loaded from a certificate stored in an Azure Key Vault, and provides everything needed to automatically handle seamless rollover to new versions of the certificate without requiring any reboot of the application.
using IdentityServer4.Stores;
using Microsoft.Azure.KeyVault;
using Microsoft.Azure.Services.AppAuthentication;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Collections.Generic;
@kroymann
kroymann / BlobStorageImageProvider.cs
Created December 29, 2018 05:24
Sample implementation of the ImageSharp IImageProvider/IImageResolver interfaces that uses an Azure Blob Storage account as the image source
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using Microsoft.WindowsAzure.Storage;
using SixLabors.ImageSharp.Web.Providers;
using SixLabors.ImageSharp.Web.Resolvers;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace BlobStorageSample