Skip to content

Instantly share code, notes, and snippets.

@brockallen
brockallen / gist:5644060
Last active December 17, 2015 17:09
Preventing the browser validation message
$('#myForm input').on('invalid', function(e) {
e.preventDefault();
var msg = e.target.validationMessage;
// Display msg here...
});
@brockallen
brockallen / github_identity_clone.cmd
Last active September 5, 2016 22:41
script to restore identity github repos
md identity
cd identity
md server3
cd server3
git clone -b dev https://github.com/IdentityServer/IdentityServer3.git IdentityServer3
git clone -b dev https://github.com/IdentityServer/IdentityServer3.AccessTokenValidation.git AccessTokenValidation
git clone -b dev https://github.com/IdentityServer/IdentityServer3.Samples.git Samples
@brockallen
brockallen / gist:46a2a24550cc22aa2a1bb224001a63c2
Created June 22, 2016 13:51
deadlock fix for ws-fed/oidc katana middleware
namespace Common
{
public class AdapterConfigurationManager : IConfigurationManager<OpenIdConnectConfiguration>
{
private readonly IConfigurationManager<OpenIdConnectConfiguration> _inner;
public AdapterConfigurationManager(IConfigurationManager<OpenIdConnectConfiguration> inner)
{
_inner = inner;
}
@brockallen
brockallen / gist:48bce00681a87ba3325d74f09f72874a
Created June 23, 2016 18:01
ASP.NET Core MVC action method snippets
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>mvcaction</Title>
<Shortcut>mvcaction</Shortcut>
<Description>Code snippet for an action.</Description>
<Author>Microsoft Corporation</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
public static class PrincipalExtensions
{
public static string GetValue(this ClaimsPrincipal user, string type)
{
var claim = user.FindFirst(type);
if (claim != null) return claim.Value;
return null;
}
public static string GetValue(this IPrincipal user, string type)
#
# Generates a new cert in a .pfx file
#
param(
[Parameter(Mandatory = $true)]
$Name,
[Parameter(Mandatory = $true)]
$Password,
$Duration = 120
"C:\Program Files (x86)\IIS Express\IisExpressAdminCmd.exe" setupSslUrl -url:https://test.local:44333 -CertHash:<thumbprint>