Created
November 2, 2016 09:44
-
-
Save HNeukermans/d2252e9107ded8d0fb867aef300222f4 to your computer and use it in GitHub Desktop.
Azure Signalr MachineKeyProtectionProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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