Cleanup DataProtectionTokenProvider

This commit is contained in:
Hao Kung 2015-01-12 12:34:16 -08:00
parent b59440d95f
commit 4eff17c9b2
2 changed files with 4 additions and 8 deletions

View File

@ -25,15 +25,11 @@ namespace Microsoft.AspNet.Identity
/// <param name="options">The configured <see cref="DataProtectionTokenProviderOptions"/>.</param>
public DataProtectorTokenProvider(IDataProtectionProvider dataProtectionProvider, IOptions<DataProtectionTokenProviderOptions> options)
{
if (options == null || options.Options == null)
{
throw new ArgumentNullException(nameof(options));
}
if (dataProtectionProvider == null)
{
throw new ArgumentNullException(nameof(dataProtectionProvider));
}
Options = options.Options;
Options = options?.Options ?? new DataProtectionTokenProviderOptions();
// Use the Name as the purpose which should usually be distinct from others
Protector = dataProtectionProvider.CreateProtector(Name ?? "DataProtectorTokenProvider");
}
@ -44,7 +40,7 @@ namespace Microsoft.AspNet.Identity
/// <value>
/// The <see cref="DataProtectionTokenProviderOptions"/> for this instance.
/// </value>
public DataProtectionTokenProviderOptions Options { get; private set; }
protected DataProtectionTokenProviderOptions Options { get; private set; }
/// <summary>
/// Gets the <see cref="IDataProtector"/> for this instance.
@ -52,7 +48,7 @@ namespace Microsoft.AspNet.Identity
/// <value>
/// The <see cref="IDataProtector"/> for this instance.
/// </value>
public IDataProtector Protector { get; private set; }
protected IDataProtector Protector { get; private set; }
/// <summary>
/// Gets the name of this instance.

View File

@ -16,7 +16,7 @@ namespace Microsoft.AspNet.Identity
/// <value>
/// The name of the <see cref="DataProtectorTokenProvider{TUser}"/>.
/// </value>
public string Name { get; set; } = "DataProtection";
public string Name { get; set; } = "DataProtectorTokenProvider";
/// <summary>
/// Gets or sets the amount of time a generated token remains valid.