refactorisation : separation du code serveur d'authentification

This commit is contained in:
Paul Schneider 2018-03-23 13:51:48 +01:00
commit b462350d72
57 changed files with 5452 additions and 108 deletions

View file

@ -0,0 +1,38 @@
using System;
using System.IO;
using Microsoft.AspNet.DataProtection;
public class MonoDataProtectionProvider : IDataProtectionProvider
{
private readonly string appName;
public MonoDataProtectionProvider()
: this(Guid.NewGuid().ToString())
{ }
public MonoDataProtectionProvider(DirectoryInfo dataProtectionDirInfo)
: this(Guid.NewGuid().ToString())
{
}
public MonoDataProtectionProvider(string appName)
{
if (appName == null) { throw new ArgumentNullException("appName"); }
this.appName = appName;
}
public IDataProtector Create(params string[] purposes)
{
if (purposes == null) { throw new ArgumentNullException("profile"); }
return new MonoDataProtector(appName, purposes);
}
public IDataProtector CreateProtector(string purpose)
{
return Create(new string[] { purpose });
}
}