Skip to content

Instantly share code, notes, and snippets.

@HNeukermans
Created November 2, 2016 09:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HNeukermans/d2252e9107ded8d0fb867aef300222f4 to your computer and use it in GitHub Desktop.
Save HNeukermans/d2252e9107ded8d0fb867aef300222f4 to your computer and use it in GitHub Desktop.
Azure Signalr MachineKeyProtectionProvider
using Microsoft.Owin.Security.DataProtection;
...
appBuilder.SetDataProtectionProvider(new MachineKeyProtectionProvider());
...
internal class MachineKeyProtectionProvider : IDataProtectionProvider
{
public IDataProtector Create(params string[] purposes)
{
return new MachineKeyDataProtector(purposes);
}
}
internal class MachineKeyDataProtector : IDataProtector
{
private readonly string[] _purposes;
public MachineKeyDataProtector(string[] purposes)
{
_purposes = purposes;
}
public byte[] Protect(byte[] userData)
{
//return MachineKey.Protect(userData, _purposes);
return userData;
}
public byte[] Unprotect(byte[] protectedData)
{
//return System.Web.Security.MachineKey.Unprotect(protectedData, _purposes);
return protectedData;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment