Skip to content

Instantly share code, notes, and snippets.

View phillipsj's full-sized avatar

Jamie Phillips phillipsj

View GitHub Profile
@phillipsj
phillipsj / DataProtectionError.txt
Last active October 8, 2015 00:44
StackTrace of Data Protection Error
[CryptographicException: The data protection operation was unsuccessful. This may have been caused by not having the user profile loaded for the current thread's user context, which may be the case when the thread is impersonating.]
System.Security.Cryptography.ProtectedData.Protect(Byte[] userData, Byte[] optionalEntropy, DataProtectionScope scope) +514
System.Security.Cryptography.DpapiDataProtector.ProviderProtect(Byte[] userData) +75
Microsoft.Owin.Security.DataHandler.SecureDataFormat`1.Protect(TData data) +93
Microsoft.Owin.Security.OpenIdConnect.<ApplyResponseChallengeAsync>d__c.MoveNext() +1342
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +61
Microsoft.Owin.Security.Infrastructure.<ApplyResponseCoreAsync>d__b.MoveNext() +531
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +13877064
System.Runtime.CompilerServices.Task
@phillipsj
phillipsj / MachineKeyDataProtector.cs
Created October 8, 2015 00:52
MachineKeyDataProtector Implementation from StackOverflow
public class MachineKeyProtectionProvider : IDataProtectionProvider
{
public IDataProtector Create(params string[] purposes)
{
return new MachineKeyDataProtector(purposes);
}
}
public class MachineKeyDataProtector : IDataProtector
{
@phillipsj
phillipsj / packages.config
Created November 25, 2015 17:42
Web Compiler Packages Config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.5.5" />
<package id="Cake.MSBuildTask" version="0.0.4"/>
<package id="BuildWebCompiler" version="1.8.273"/>
</packages>
@phillipsj
phillipsj / Build.cale
Created November 25, 2015 17:44
Build.cake for for adding web compiler
// Addins
#addin Cake.MSBuildTask
#r .\tools\BuildWebCompiler\tools\WebCompiler.exe
@phillipsj
phillipsj / Build.cs
Created November 25, 2015 17:45
Compile JSX using Web Compiler and CAKE
Task("CompileJSX")
.Does(() => {
var compilerConfigs = GetFiles("./src/Orchard.Web/Modules/**/compilerconfig.json");
foreach(var compilerConfig in compilerConfigs){
Information(string.Format("Compliing JSX for {0}.", compilerConfig.ToString()));
var webCompilerClean = new WebCompiler.CompilerCleanTask();
webCompilerClean.FileName = compilerConfig.ToString();
MSBuildTaskExecute(webCompilerClean);
var webCompilerBuild = new WebCompiler.CompilerBuildTask();
@phillipsj
phillipsj / syntax.cs
Created November 30, 2015 23:48
Addin Syntax with Source specificed
#addin <Package Name> <Source: MyGet, TeamCity, Etc>
@phillipsj
phillipsj / OldSyntax.cs
Last active November 30, 2015 23:53
Old Syntax
#r .\tools\<package>\lib\net45\<dll>
@phillipsj
phillipsj / OwinMiddlware.cs
Created October 8, 2015 01:00
Setting DataProtectionProvider Alternative
public class OwinMiddlewares : IOwinMiddlewareProvider {
public ILogger Logger { get; set; }
public OwinMiddlewares() {
Logger = NullLogger.Instance;
}
public IEnumerable<OwinMiddlewareRegistration> GetOwinMiddlewares() {
var middlewares = new List<OwinMiddlewareRegistration>();
middlewares.Add(new OwinMiddlewareRegistration
@phillipsj
phillipsj / mailToLink.js
Created May 27, 2016 12:33
EmberHelpers
@phillipsj
phillipsj / CustomClassMapper.cs
Created May 27, 2016 09:50
DapperExtensions Mapper
public class CustomClassMapper<T>: ClassMapper<T>,
SqlMapper.ITypeMap where T : class
{
public ConstructorInfo FindConstructor(string[] names, Type[] types)
{
return this.EntityType.GetConstructor(Type.EmptyTypes);
}
public ConstructorInfo FindExplicitConstructor()
{