public static string GetRedirectUrl(SignInMessage message, IDictionary<string, object> env, IDataProtector protector) { var result = new LoginResult(message, env, protector); var response = result.Execute(); return response.Headers.Location.AbsoluteUri; }
public void SetUp() { _entropyCreator = _entropyCreator.Fake(); _dataProtectorFactory = _dataProtectorFactory.Fake(); _sut = new LocalMachineScopeStringEncryptor(_entropyCreator, _dataProtectorFactory); _dataProtector = _dataProtector.Fake(); }
/// <summary> /// Initializes a new instance of the <see cref="AzureWebHookStore"/> class with the given <paramref name="manager"/>, /// <paramref name="settings"/>, <paramref name="protector"/>, and <paramref name="logger"/>. /// Using this constructor, the data will be encrypted using the provided <paramref name="protector"/>. /// </summary> public AzureWebHookStore(IStorageManager manager, SettingsDictionary settings, IDataProtector protector, ILogger logger) : this(manager, settings, logger) { if (protector == null) { throw new ArgumentNullException(nameof(protector)); } _protector = protector; }
private DataProtectionTokenProvider() { IDataProtectionProvider provider = ProviderFactory(); string[] purposes = Enum.GetValues(typeof(ContactChallengePurpose)) .Cast<ContactChallengePurpose>() .Except(new[] { ContactChallengePurpose.Invalid }) .Select(x => x.ToString()) .ToArray(); Protector = provider.CreateProtector(GetType().Assembly.GetName().Name, purposes); }
public DefaultAntiforgeryTokenSerializer(IDataProtectionProvider provider) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } _cryptoSystem = provider.CreateProtector(Purpose); }
public UserProfileAuthenticatorDataRepository(IDataProtectionProvider dataProtectionProvider, IEnrollmentClient enrollmentService, ILoggerFactory loggerFactory) { if (dataProtectionProvider == null) throw new ArgumentNullException(nameof(dataProtectionProvider)); if (enrollmentService == null) throw new ArgumentNullException(nameof(enrollmentService)); if (loggerFactory == null) throw new ArgumentNullException(nameof(loggerFactory)); _dataProtector = dataProtectionProvider.CreateProtector(GetType().FullName); _enrollmentservice = enrollmentService; _logger = loggerFactory.CreateLogger<UserProfileAuthenticatorDataRepository>(); }
public DataProtectionProviderProtectedData(IDataProtectionProvider provider) { if (provider == null) { throw new ArgumentNullException("provider"); } _provider = provider; _connectionTokenProtector = provider.CreateProtector(Purposes.ConnectionToken); _groupsProtector = provider.CreateProtector(Purposes.Groups); }
//public string LoginHint { get; set; } //public string AuthenticationMethod { get; set; } public string Protect(int ttl, IDataProtector protector) { ValidTo = DateTime.UtcNow.AddSeconds(ttl); var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; var json = JsonConvert.SerializeObject(this, settings); return protector.Protect(json, "signinmessage"); }
public static SignInMessage Unprotect(string data, IDataProtector protector) { var json = protector.Unprotect(data, "signinmessage"); var message = JsonConvert.DeserializeObject<SignInMessage>(json); if (DateTime.UtcNow > message.ValidTo) { throw new Exception("SignInMessage expired."); } return message; }
public static void Apply(this CommandResult commandResult, IOwinContext context, IDataProtector dataProtector) { if (commandResult == null) { throw new ArgumentNullException(nameof(commandResult)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } context.Response.ContentType = commandResult.ContentType; context.Response.StatusCode = (int)commandResult.HttpStatusCode; if (commandResult.Location != null) { context.Response.Headers["Location"] = commandResult.Location.OriginalString; } if (commandResult.Content != null) { // Remove value set by other middleware and let the host calculate // a new value. See issue #295 for discussion on this. context.Response.ContentLength = null; context.Response.Write(commandResult.Content); } if(commandResult.TerminateLocalSession) { context.Authentication.SignOut(); } if(!string.IsNullOrEmpty(commandResult.SetCookieData)) { var protectedData = HttpRequestData.EscapeBase64CookieValue( Convert.ToBase64String( dataProtector.Protect( Encoding.UTF8.GetBytes( commandResult.SetCookieData)))); context.Response.Cookies.Append( commandResult.SetCookieName, protectedData, new CookieOptions() { HttpOnly = true, }); } }
internal static RSAParameters? DecryptKey(IDataProtector protector, byte[] buffer, out string usage) { if (protector == null) { throw new ArgumentNullException(nameof(protector)); } if (buffer == null) { throw new ArgumentNullException(nameof(buffer)); } usage = null; // Note: an exception thrown in this block may be caused by a corrupted or inappropriate key // (for instance, if the key was created for another application or another environment). // Always catch the exception and return null in this case to avoid leaking sensitive data. try { var bytes = protector.Unprotect(buffer); if (bytes == null) { return null; } using (var stream = new MemoryStream(bytes)) using (var reader = new BinaryReader(stream)) { if (/* version: */ reader.ReadInt32() != 2) { return null; } // Note: only RSA keys are currently supported. Return null if another format has been used. if (!string.Equals(/* algorithm: */ reader.ReadString(), "RSA", StringComparison.OrdinalIgnoreCase)) { return null; } // Read the usage from the serialized key. usage = reader.ReadString(); // Extract the RSA parameters from the serialized key. return new RSAParameters { D = reader.ReadBytes(reader.ReadInt32()), DP = reader.ReadBytes(reader.ReadInt32()), DQ = reader.ReadBytes(reader.ReadInt32()), Exponent = reader.ReadBytes(reader.ReadInt32()), InverseQ = reader.ReadBytes(reader.ReadInt32()), Modulus = reader.ReadBytes(reader.ReadInt32()), P = reader.ReadBytes(reader.ReadInt32()), Q = reader.ReadBytes(reader.ReadInt32()) }; } } catch { return null; } }
//public string LoginHint { get; set; } //public string AuthenticationMethod { get; set; } public string Protect(int ttl, IDataProtector protector) { ValidTo = DateTime.UtcNow.AddSeconds(ttl); var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, }; var json = JsonConvert.SerializeObject(this, settings); Logger.DebugFormat("Protecting signin message: {0}", json); return protector.Protect(json, "signinmessage"); }
public DefaultAntiforgeryTokenSerializer( IDataProtectionProvider provider, ObjectPool<AntiforgerySerializationContext> pool) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } if (pool == null) { throw new ArgumentNullException(nameof(pool)); } _cryptoSystem = provider.CreateProtector(Purpose); _pool = pool; }
public static SignInMessage Unprotect(string data, IDataProtector protector) { var settings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore }; var json = protector.Unprotect(data, "signinmessage"); var message = JsonConvert.DeserializeObject<SignInMessage>(json); if (DateTime.UtcNow > message.ValidTo) { throw new Exception("SignInMessage expired."); } return message; }
/// <summary> /// Initializes a new instance of the <see cref="SqlWebHookStore"/> class with the given <paramref name="settings"/>, /// <paramref name="protector"/>, and <paramref name="logger"/>. /// </summary> public SqlWebHookStore(SettingsDictionary settings, IDataProtector protector, ILogger logger) { if (settings == null) { throw new ArgumentNullException("settings"); } if (protector == null) { throw new ArgumentNullException("protector"); } if (logger == null) { throw new ArgumentNullException("logger"); } CheckSqlStorageConnectionString(settings); _protector = protector; _logger = logger; }
/// <summary> /// Initializes a new instance of <see cref="Tailspin.Surveys.TokenStorage.DistributedTokenCache"/> /// </summary> /// <param name="claimsPrincipal">A <see cref="System.Security.Claims.ClaimsPrincipal"/> for the signed in user</param> /// <param name="distributedCache">An implementation of <see cref="Microsoft.Extensions.Caching.Distributed.IDistributedCache"/> in which to store the access tokens.</param> /// <param name="loggerFactory"><see cref="Microsoft.Extensions.Logging.ILoggerFactory"/> used to create type-specific <see cref="Microsoft.Extensions.Logging.ILogger"/> instances.</param> /// <param name="dataProtectionProvider">An <see cref="Microsoft.AspNet.DataProtection.IDataProtectionProvider"/> for creating a data protector.</param> public DistributedTokenCache( ClaimsPrincipal claimsPrincipal, IDistributedCache distributedCache, ILoggerFactory loggerFactory, IDataProtectionProvider dataProtectionProvider) : base() { Guard.ArgumentNotNull(claimsPrincipal, nameof(claimsPrincipal)); Guard.ArgumentNotNull(distributedCache, nameof(distributedCache)); Guard.ArgumentNotNull(loggerFactory, nameof(loggerFactory)); Guard.ArgumentNotNull(dataProtectionProvider, nameof(dataProtectionProvider)); _claimsPrincipal = claimsPrincipal; _cacheKey = BuildCacheKey(_claimsPrincipal); _distributedCache = distributedCache; _logger = loggerFactory.CreateLogger<DistributedTokenCache>(); _protector = dataProtectionProvider.CreateProtector(typeof(DistributedTokenCache).FullName); AfterAccess = AfterAccessNotification; LoadFromCache(); }
private static void ApplyCookies(CommandResult commandResult, IOwinContext context, IDataProtector dataProtector) { var serializedCookieData = commandResult.GetSerializedRequestState(); if (serializedCookieData != null) { var protectedData = HttpRequestData.ConvertBinaryData( dataProtector.Protect(serializedCookieData)); context.Response.Cookies.Append( commandResult.SetCookieName, protectedData, new CookieOptions() { HttpOnly = true, }); } commandResult.ApplyClearCookie(context); }
private void Setup() { var services = new ServiceCollection(); //http://docs.asp.net/en/latest/security/data-protection/configuration/overview.html //If you change the key persistence location, the system will no longer automatically encrypt keys // at rest since it doesn’t know whether DPAPI is an appropriate encryption mechanism. //services.ConfigureDataProtection(configure => //{ //string pathToCryptoKeys = @"C:\_joe\__projects\__cloudscribe\_code\cloudscribe\src\example.WebApp\dp_keys\"; // these keys are not encrypted at rest // since we have specified a non default location // that also makes the key portable so they will still work if we migrate to // a new machine (will they work on different OS? I think so) // this is a similar server migration issue as the old machinekey // where we specified a machinekey in web.config so it would not change if we migrate to a new server //configure.PersistKeysToFileSystem( // new DirectoryInfo(pathToCryptoKeys) // ); //configure.ProtectKeysWithCertificate("thumbprint"); //configure.SetDefaultKeyLifetime(TimeSpan.FromDays(14)); ///configure. //}); //IDataProtectionProvider dataProtectionProvider services.AddDataProtection(); serviceProvider = services.BuildServiceProvider(); dataProtectionProvider = serviceProvider.GetService<IDataProtectionProvider>(); rawProtector = dataProtectionProvider.CreateProtector("sts.Licensing.Web.KeyPairManager"); persistentProtector = rawProtector as IPersistedDataProtector; didSetup = true; }
public static void Apply(this CommandResult commandResult, IOwinContext context, IDataProtector dataProtector) { if (commandResult == null) { throw new ArgumentNullException(nameof(commandResult)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } context.Response.ContentType = commandResult.ContentType; context.Response.StatusCode = (int)commandResult.HttpStatusCode; if (commandResult.Location != null) { context.Response.Headers["Location"] = commandResult.Location.OriginalString; } if (commandResult.TerminateLocalSession) { context.Authentication.SignOut(); } ApplyCookies(commandResult, context, dataProtector); // Write the content last, it causes the headers to be flushed // on some hosts. if (commandResult.Content != null) { // Remove value set by other middleware and let the host calculate // a new value. See issue #295 for discussion on this. context.Response.ContentLength = null; context.Response.Write(commandResult.Content); } }
internal static byte[] EncryptKey(IDataProtector protector, RSAParameters parameters, string usage) { if (protector == null) { throw new ArgumentNullException(nameof(protector)); } if (string.IsNullOrEmpty(usage)) { throw new ArgumentNullException(nameof(usage)); } using (var stream = new MemoryStream()) using (var writer = new BinaryWriter(stream)) { writer.Write(/* version: */ 2); writer.Write(/* algorithm: */ "RSA"); writer.Write(/* usage: */ usage); // Serialize the RSA parameters to the key file. writer.Write(parameters.D.Length); writer.Write(parameters.D); writer.Write(parameters.DP.Length); writer.Write(parameters.DP); writer.Write(parameters.DQ.Length); writer.Write(parameters.DQ); writer.Write(parameters.Exponent.Length); writer.Write(parameters.Exponent); writer.Write(parameters.InverseQ.Length); writer.Write(parameters.InverseQ); writer.Write(parameters.Modulus.Length); writer.Write(parameters.Modulus); writer.Write(parameters.P.Length); writer.Write(parameters.P); writer.Write(parameters.Q.Length); writer.Write(parameters.Q); // Encrypt the key using the data protection block. return protector.Protect(stream.ToArray()); } }
/// <summary> /// Initializes a new instance of the <see cref="AzureWebHookStore"/> class with the given <paramref name="manager"/>, /// <paramref name="settings"/>, <paramref name="protector"/>, and <paramref name="logger"/>. /// </summary> public AzureWebHookStore(IStorageManager manager, SettingsDictionary settings, IDataProtector protector, ILogger logger) { if (manager == null) { throw new ArgumentNullException("manager"); } if (settings == null) { throw new ArgumentNullException("settings"); } if (protector == null) { throw new ArgumentNullException("protector"); } if (logger == null) { throw new ArgumentNullException("logger"); } _manager = manager; _connectionString = manager.GetAzureStorageConnectionString(settings); _protector = protector; _logger = logger; }
public CachedPropertiesDataFormat( IDistributedCache cache, IDataProtector dataProtector) : this(cache, dataProtector, new PropertiesSerializer()) { }
public static IAppBuilder ConfigureCookieAuthentication(this IAppBuilder app, CookieOptions options, IDataProtector dataProtector) { if (options == null) throw new ArgumentNullException("options"); if (dataProtector == null) throw new ArgumentNullException("dataProtector"); if (options.Prefix != null && options.Prefix.Length > 0) { options.Prefix += "."; } var primary = new CookieAuthenticationOptions { AuthenticationType = Constants.PrimaryAuthenticationType, CookieName = options.Prefix + Constants.PrimaryAuthenticationType, ExpireTimeSpan = options.ExpireTimeSpan, SlidingExpiration = options.SlidingExpiration, TicketDataFormat = new TicketDataFormat(new DataProtectorAdapter(dataProtector, options.Prefix + Constants.PrimaryAuthenticationType)) }; app.UseCookieAuthentication(primary); var external = new CookieAuthenticationOptions { AuthenticationType = Constants.ExternalAuthenticationType, CookieName = options.Prefix + Constants.ExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive, ExpireTimeSpan = Constants.ExternalCookieTimeSpan, SlidingExpiration = false, TicketDataFormat = new TicketDataFormat(new DataProtectorAdapter(dataProtector, options.Prefix + Constants.ExternalAuthenticationType)) }; app.UseCookieAuthentication(external); var partial = new CookieAuthenticationOptions { AuthenticationType = Constants.PartialSignInAuthenticationType, CookieName = options.Prefix + Constants.PartialSignInAuthenticationType, AuthenticationMode = AuthenticationMode.Passive, ExpireTimeSpan = options.ExpireTimeSpan, SlidingExpiration = options.SlidingExpiration, TicketDataFormat = new TicketDataFormat(new DataProtectorAdapter(dataProtector, options.Prefix + Constants.PartialSignInAuthenticationType)) }; app.UseCookieAuthentication(partial); Action<string> setCookiePath = path => { if (!String.IsNullOrWhiteSpace(path)) { primary.CookiePath = external.CookiePath = path; // TODO: should we leave the partial path to "/"? partial.CookiePath = path; } }; if (String.IsNullOrWhiteSpace(options.Path)) { app.Use(async (ctx, next) => { // we only want this to run once, so assign to null once called // (and yes, it's possible that many callers hit this at same time, // but the set is idempotent) if (setCookiePath != null) { setCookiePath(ctx.Request.PathBase.Value); setCookiePath = null; } await next(); }); } else { setCookiePath(options.Path); } return app; }
public DataProtector(IDataProtectionProvider dataProtectionProvider) { m_DataProtectionProvider = dataProtectionProvider.CreateProtector("IpEmail.Protector.v1"); }
public static IAppBuilder ConfigureCookieAuthentication(this IAppBuilder app, CookieOptions options, IDataProtector dataProtector) { if (options == null) throw new ArgumentNullException("options"); if (dataProtector == null) throw new ArgumentNullException("dataProtector"); if (options.Prefix.IsPresent()) { options.Prefix += "."; } var primary = new CookieAuthenticationOptions { AuthenticationType = Constants.PrimaryAuthenticationType, CookieName = options.Prefix + Constants.PrimaryAuthenticationType, ExpireTimeSpan = options.ExpireTimeSpan, SlidingExpiration = options.SlidingExpiration, CookieSecure = GetCookieSecure(options.SecureMode), TicketDataFormat = new TicketDataFormat(new DataProtectorAdapter(dataProtector, options.Prefix + Constants.PrimaryAuthenticationType)), SessionStore = GetSessionStore(options.SessionStoreProvider), Provider = new CookieAuthenticationProvider { OnValidateIdentity = async cookieCtx => { var validator = cookieCtx.OwinContext.Environment.ResolveDependency<IAuthenticationSessionValidator>(); var isValid = await validator.IsAuthenticationSessionValidAsync(new ClaimsPrincipal(cookieCtx.Identity)); if (isValid == false) { cookieCtx.RejectIdentity(); } } } }; app.UseCookieAuthentication(primary); var external = new CookieAuthenticationOptions { AuthenticationType = Constants.ExternalAuthenticationType, CookieName = options.Prefix + Constants.ExternalAuthenticationType, AuthenticationMode = AuthenticationMode.Passive, ExpireTimeSpan = Constants.ExternalCookieTimeSpan, SlidingExpiration = false, CookieSecure = GetCookieSecure(options.SecureMode), TicketDataFormat = new TicketDataFormat(new DataProtectorAdapter(dataProtector, options.Prefix + Constants.ExternalAuthenticationType)) }; app.UseCookieAuthentication(external); var partial = new CookieAuthenticationOptions { AuthenticationType = Constants.PartialSignInAuthenticationType, CookieName = options.Prefix + Constants.PartialSignInAuthenticationType, AuthenticationMode = AuthenticationMode.Passive, ExpireTimeSpan = options.ExpireTimeSpan, SlidingExpiration = options.SlidingExpiration, CookieSecure = GetCookieSecure(options.SecureMode), TicketDataFormat = new TicketDataFormat(new DataProtectorAdapter(dataProtector, options.Prefix + Constants.PartialSignInAuthenticationType)) }; app.UseCookieAuthentication(partial); Action<string> setCookiePath = path => { if (!String.IsNullOrWhiteSpace(path)) { primary.CookiePath = external.CookiePath = path; partial.CookiePath = path; } }; if (String.IsNullOrWhiteSpace(options.Path)) { app.Use(async (ctx, next) => { // we only want this to run once, so assign to null once called // (and yes, it's possible that many callers hit this at same time, // but the set is idempotent) if (setCookiePath != null) { setCookiePath(ctx.Request.PathBase.Value); setCookiePath = null; } await next(); }); } else { setCookiePath(options.Path); } return app; }
public AccountController(IServicioUsuario usuarioManager, IDataProtectionProvider dataProtectionProvider, Helper dataHelper) { this.usuarioManager = usuarioManager; this.protector = dataProtectionProvider.CreateProtector(dataHelper.CodigoEnrutar); }
// the 'provider' parameter is provided by DI public MyClass(IDataProtectionProvider provider) { _protector = provider.CreateProtector("Contoso.MyClass.v1"); }
/// <summary> /// Initializes a new instance of <see cref="PropertiesDataFormat"/>. /// </summary> /// <param name="protector">The <see cref="IDataProtector"/>.</param> public PropertiesDataFormat(IDataProtector protector) : base(new PropertiesSerializer(), protector) { }
public DataProtectorAdapter(IDataProtector idsrvProtector, string entropy) { _idsrvProtector = idsrvProtector; _entropy = entropy; }
public AccountController(IDataProtectionProvider dataProtectionProvider, UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager) { _dataProtector = dataProtectionProvider.CreateProtector("SignIn"); _userManager = userManager; _signInManager = signInManager; }
internal WsAccount(WsSerializableAccount accountConfig, Action onChange, IDataProtector protector) { AccountConfig = accountConfig; _onChange = onChange; _protector = new Protector(protector); }
public static async Task Apply( this CommandResult commandResult, HttpContext httpContext, IDataProtector dataProtector, string signInScheme, string signOutScheme, bool emitSameSiteNone) { httpContext.Response.StatusCode = (int)commandResult.HttpStatusCode; if (commandResult.Location != null) { httpContext.Response.Headers["Location"] = commandResult.Location.OriginalString; } if (!string.IsNullOrEmpty(commandResult.SetCookieName)) { var cookieData = HttpRequestData.ConvertBinaryData( dataProtector.Protect(commandResult.GetSerializedRequestState())); httpContext.Response.Cookies.Append( commandResult.SetCookieName, cookieData, new CookieOptions() { HttpOnly = true, Secure = commandResult.SetCookieSecureFlag, // We are expecting a different site to POST back to us, // so the ASP.Net Core default of Lax is not appropriate in this case SameSite = emitSameSiteNone ? SameSiteMode.None : (SameSiteMode)(-1), IsEssential = true }); } foreach (var h in commandResult.Headers) { httpContext.Response.Headers.Add(h.Key, h.Value); } if (!string.IsNullOrEmpty(commandResult.ClearCookieName)) { httpContext.Response.Cookies.Delete( commandResult.ClearCookieName, new CookieOptions { Secure = commandResult.SetCookieSecureFlag }); } if (!string.IsNullOrEmpty(commandResult.Content)) { var buffer = Encoding.UTF8.GetBytes(commandResult.Content); httpContext.Response.ContentType = commandResult.ContentType; await httpContext.Response.Body.WriteAsync(buffer, 0, buffer.Length); } if (commandResult.Principal != null) { var authProps = new AuthenticationProperties(commandResult.RelayData) { RedirectUri = commandResult.Location.OriginalString }; await httpContext.SignInAsync(signInScheme, commandResult.Principal, authProps); } if (commandResult.TerminateLocalSession) { await httpContext.SignOutAsync(signOutScheme ?? signInScheme); } }
public ValuesController(IDataProtectionProvider protectionProvider) { _protector = protectionProvider.CreateProtector("Unique_Value"); }
public BudgetCategoryController(PersonalBudgetContext context, IDataProtectionProvider protectionprovider, StringConstants strconsts) { this.protector = protectionprovider.CreateProtector(strconsts.IdQryStr); _context = context; }
public SecureDataFormat(IDataSerializer <TData> serializer, IDataProtector protector, ITextEncoder encoder) { this._serializer = serializer; this._protector = protector; this._encoder = encoder; }
public ProtectedDataMessageStore(IDataProtectionProvider provider, ILogger <ProtectedDataMessageStore <TModel> > logger) { _protector = provider.CreateProtector(purpose); _logger = logger; }
public CookieManager(SignInManager <ApplicationUser> signInManager, IDataProtectionProvider protectionProvider) { this.signInManager = signInManager; this.protector = protectionProvider.CreateProtector("app-cookie"); }
public HomeController(IDataProtectionProvider provider) { _protector = provider.CreateProtector(GetType().FullName); }
public AuthorizationController(IAuthorizationRequestHandler authorizationRequestHandler, IResponseModeHandler responseModeHandler, IDataProtectionProvider dataProtectionProvider) { _authorizationRequestHandler = authorizationRequestHandler; _responseModeHandler = responseModeHandler; _dataProtector = dataProtectionProvider.CreateProtector("Authorization"); }
/// <summary> /// Constructor /// </summary> /// <param name="protector"></param> public DataProtectorTokenProvider(IDataProtector protector) : base(protector) { }
public ConnectionProducer(IDataProtector protector, string decrypted) { this.protector = protector; this.decryptedValue = decrypted; }
public DataProtectorTokenProvider(IDataProtector protector)
public RegisterController(IUsers users, IDataProtectionProvider dataProtectionProvider, DPPurposeStrings dPPurposeStrings) { dataProtector = dataProtectionProvider.CreateProtector(dPPurposeStrings.ClientIDKey); this.users = users; }
public HomeController(IDataProtectionProvider provider) { _protector = provider.CreateProtector("DemoTime"); }
public CircuitIdFactory(IDataProtectionProvider provider) { _protector = provider.CreateProtector(CircuitIdProtectorPurpose); }
public DataProtectionKeyValueConverter(FileAccess access) : base(access) { var provider = DataProtectionProvider.CreateAzureDataProtector(); _dataProtector = provider.CreateProtector("function-secrets"); }
public EnhancedTicketDataFormat(IDataProtector protector) : base(Serializer, protector, TextEncodings.Base64Url) { }
public MeController(IDataProtectionProvider provider) { _protector = provider.CreateProtector("TokenConverter"); }
public LoginController(TodoContext context, IDataProtectionProvider provider, IConfiguration config) { _dbContext = context; _config = config; _provider = provider.CreateProtector(_config["secretKey"]); }
private IDataProtector _innerProtectorWithTimeLimitedPurpose; // created on-demand public TimeLimitedDataProtector(IDataProtector innerProtector) { _innerProtector = innerProtector; }
public SharedFileSecretCredentialsFactory(XtiFolder xtiFolder, IDataProtector dataProtector) : base(dataProtector) { this.xtiFolder = xtiFolder; }
void ConfigureDataProtectorCreator_ToReturn(byte[] entropy, IDataProtector dataProtector) { A.CallTo(() => _dataProtectorFactory.Create(A<byte[]>.That.IsSameSequenceAs(entropy))) .Returns(dataProtector); }
protected override SecretCredentials _Create(string key, IDataProtector dataProtector) => new SharedFileSecretCredentials(xtiFolder, key, dataProtector);
/// <summary> /// Initializes a new instance of the <see cref="CacheService"/> class. /// </summary> /// <param name="service">Provides access to core services.c</param> /// <param name="connection">Connection to utilized to communicate with the Redis Cache instance.</param> /// <param name="dataProtector">Provides protection for data being cached.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="service"/> is null. /// or /// <paramref name="connection"/> is null. /// or /// <paramref name="dataProtector"/> is null. /// </exception> public CacheService(IExplorerService service, IConnectionMultiplexer connection, IDataProtector dataProtector) { service.AssertNotNull(nameof(service)); connection.AssertNotNull(nameof(connection)); dataProtector.AssertNotNull(nameof(dataProtector)); this.connection = connection; this.protector = dataProtector; this.service = service; }
/// <summary> /// Initializes a new instance of <see cref="SecureDataFormat{TData}"/>. /// </summary> /// <param name="serializer">The <see cref="IDataSerializer{TModel}"/>.</param> /// <param name="protector">The <see cref="IDataProtector"/>.</param> public SecureDataFormat(IDataSerializer <TData> serializer, IDataProtector protector) { _serializer = serializer; _protector = protector; }
public RSAKeyUtils(IDataProtectionProvider aProvider) { mProtector = aProvider.CreateProtector("TestProtector"); }
public DataProtector(IDataProtectionProvider dataProtectionProvider, DataProtectionPurposeStrings purposeStrings) { _dataProtector = dataProtectionProvider.CreateProtector(purposeStrings.MasterPurposeString); }
public DataProtectorFileSystem(IDataProtectionProvider provider, ILogger <DataProtectorFileSystem> logger) { this._dataProtector = provider.CreateProtector("Cloudy.Key.v1"); this._logger = logger; }
public DataProtectorTokenProvider(IDataProtector dataProtector) { this.dataProtector = dataProtector; }