Skip to content

Instantly share code, notes, and snippets.

View marklagendijk's full-sized avatar

Mark Lagendijk marklagendijk

View GitHub Profile
@marklagendijk
marklagendijk / ResponseHeaderMiddleware.cs
Created July 8, 2021 08:10
.NET Core Response Header Middleware
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
namespace MyApplication
{
public class ResponseHeaderMiddleware
{
private readonly RequestDelegate _next;
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.Options;
namespace SixLabors.ImageSharp.Web.Providers
{
public class AllowedDomainsRemoteImageUrlValidator: IRemoteImageUrlValidator
{
private readonly List<string> _allowedDomains;
var jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0b3B0YWwuY29tIiwiZXhwIjoxNDI2NDIwODAwLCJodHRwOi8vdG9wdGFsLmNvbS9qd3RfY2xhaW1zL2lzX2FkbWluIjp0cnVlLCJjb21wYW55IjoiVG9wdGFsIiwiYXdlc29tZSI6dHJ1ZX0.yRQYnWzskCZUxPwaQupWkiUzKELZ49eM7oWxAQK_ZXw';
console.log(decodeJsonWebToken(jwt));
function decodeJsonWebToken(token){
var tokenParts = token.split('.');
return {
header: decodeTokenPart(tokenParts[0]),
token: decodeTokenPart(tokenPart[1]),
signature: tokenPart[2]
};
@marklagendijk
marklagendijk / default-interpolation.js
Last active August 29, 2015 14:19
Angular Translate sanitizing proposal
/**
* @ngdoc object
* @name pascalprecht.translate.$translateDefaultInterpolation
* @requires $interpolate
*
* @description
* Uses angular's `$interpolate` services to interpolate strings against some values.
*
* @return {object} $translateInterpolator Interpolator service
*/