Skip to content

Instantly share code, notes, and snippets.

View VictorioBerra's full-sized avatar

Victorio Berra VictorioBerra

View GitHub Profile
{
"#info": {
"title": "Hello World 2!!!",
"updated": "Nov 24 2020"
},
"img": "this is the ![logo](img/ok.png) and this is the [link](#)",
"menu": ["[Home](#section-1) [Section 1](#section-1) [Section 2](#section-2) [Page 1](/about)"],
"title": "# Hello World 2!!!",
"subtitle": [
"_It is a long **established fact** that a reader will be distracted by the readable content of a page when looking at its layout._"
@VictorioBerra
VictorioBerra / ForwardedForKnownNetworkOptions.cs
Created January 21, 2020 20:51
ForwardedHeadersOptions from appsettings.json
public class ForwardedForKnownNetworkOptions
{
public string Prefix { get; set; }
public int PrefixLength { get; set; }
}
@VictorioBerra
VictorioBerra / MyAppAuithorizationPolicyprovider.cs
Created May 3, 2019 22:19
Custom DefaultAuthorizationPolicyProvider which can distinguish between a token with and without a subject, and then handle requirements accordingly.
//
// This is a combination of two things:
//
// A slight alteration of the implementation of DefaultAuthorizationPolicyProvider that creates a new PermissionRequirement similar to the PolicyServer's for later use with IPolicyServerRuntimeClient in a requirement handler.
// But only if theres a subject claim.
//
// A slight alteration of the ClaimsAuthorizationRequirement.
// Works identically to the default implemenation, but only if theres no subject claim.
//