Bye Bye Primary Ctors :(
This commit is contained in:
parent
bd7ae6d8c0
commit
545ca2907f
|
|
@ -12,34 +12,39 @@ using Microsoft.Data.Entity;
|
|||
|
||||
namespace Microsoft.AspNet.Identity.SqlServer
|
||||
{
|
||||
public class RoleStore<TRole>(DbContext context) : RoleStore<TRole, DbContext, string>(context)
|
||||
public class RoleStore<TRole> : RoleStore<TRole, DbContext, string>
|
||||
where TRole : IdentityRole
|
||||
{ }
|
||||
{
|
||||
public RoleStore(DbContext context) : base(context) { }
|
||||
}
|
||||
|
||||
public class RoleStore<TRole, TContext>(TContext context) : RoleStore<TRole, TContext, string>(context)
|
||||
public class RoleStore<TRole, TContext> : RoleStore<TRole, TContext, string>
|
||||
where TRole : IdentityRole
|
||||
where TContext : DbContext
|
||||
{ }
|
||||
{
|
||||
public RoleStore(TContext context) : base(context) { }
|
||||
}
|
||||
|
||||
public class RoleStore<TRole, TContext, TKey>(TContext context) :
|
||||
public class RoleStore<TRole, TContext, TKey> :
|
||||
IQueryableRoleStore<TRole>,
|
||||
IRoleClaimStore<TRole>
|
||||
where TRole : IdentityRole<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
where TContext : DbContext
|
||||
{
|
||||
// Primary constructor
|
||||
public RoleStore(TContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException("context");
|
||||
}
|
||||
Context = context;
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
|
||||
public TContext Context { get; } = context;
|
||||
public TContext Context { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true will call SaveChanges after CreateAsync/UpdateAsync/DeleteAsync
|
||||
|
|
|
|||
|
|
@ -13,20 +13,26 @@ using Microsoft.Data.Entity;
|
|||
|
||||
namespace Microsoft.AspNet.Identity.SqlServer
|
||||
{
|
||||
public class UserStore(DbContext context) : UserStore<IdentityUser>(context)
|
||||
{ }
|
||||
public class UserStore : UserStore<IdentityUser>
|
||||
{
|
||||
public UserStore(DbContext context) : base(context) { }
|
||||
}
|
||||
|
||||
public class UserStore<TUser>(DbContext context) : UserStore<TUser, IdentityRole, DbContext>(context)
|
||||
public class UserStore<TUser> : UserStore<TUser, IdentityRole, DbContext>
|
||||
where TUser : IdentityUser, new()
|
||||
{ }
|
||||
{
|
||||
public UserStore(DbContext context) : base(context) { }
|
||||
}
|
||||
|
||||
public class UserStore<TUser, TRole, TContext>(TContext context) : UserStore<TUser, TRole, TContext, string>(context)
|
||||
public class UserStore<TUser, TRole, TContext> : UserStore<TUser, TRole, TContext, string>
|
||||
where TUser : IdentityUser, new()
|
||||
where TRole : IdentityRole, new()
|
||||
where TContext : DbContext
|
||||
{ }
|
||||
{
|
||||
public UserStore(TContext context) : base(context) { }
|
||||
}
|
||||
|
||||
public class UserStore<TUser, TRole, TContext, TKey>(TContext context) :
|
||||
public class UserStore<TUser, TRole, TContext, TKey> :
|
||||
IUserLoginStore<TUser>,
|
||||
IUserRoleStore<TUser>,
|
||||
IUserClaimStore<TUser>,
|
||||
|
|
@ -42,17 +48,19 @@ namespace Microsoft.AspNet.Identity.SqlServer
|
|||
where TContext : DbContext
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
// Primary constructor
|
||||
|
||||
public UserStore(TContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException("context");
|
||||
}
|
||||
Context = context;
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
public TContext Context { get; } = context;
|
||||
public TContext Context { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true will call SaveChanges after CreateAsync/UpdateAsync/DeleteAsync
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ namespace Microsoft.AspNet.Identity
|
|||
/// <summary>
|
||||
/// Token provider that uses an IDataProtector to generate encrypted tokens based off of the security stamp
|
||||
/// </summary>
|
||||
public class DataProtectorTokenProvider<TUser>(DataProtectionTokenProviderOptions options, IDataProtector protector) : IUserTokenProvider<TUser> where TUser : class
|
||||
public class DataProtectorTokenProvider<TUser> : IUserTokenProvider<TUser> where TUser : class
|
||||
{
|
||||
public DataProtectorTokenProvider(DataProtectionTokenProviderOptions options, IDataProtector protector)
|
||||
{
|
||||
if (options == null)
|
||||
{
|
||||
|
|
@ -28,10 +29,12 @@ namespace Microsoft.AspNet.Identity
|
|||
{
|
||||
throw new ArgumentNullException(nameof(protector));
|
||||
}
|
||||
Options = options;
|
||||
Protector = protector;
|
||||
}
|
||||
|
||||
public DataProtectionTokenProviderOptions Options { get; } = options;
|
||||
public IDataProtector Protector { get; } = protector;
|
||||
public DataProtectionTokenProviderOptions Options { get; private set; }
|
||||
public IDataProtector Protector { get; private set; }
|
||||
|
||||
public string Name { get { return Options.Name; } }
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,18 @@ namespace Microsoft.AspNet.Identity
|
|||
/// TokenProvider that generates tokens from the user's security stamp and notifies a user via their email
|
||||
/// </summary>
|
||||
/// <typeparam name="TUser"></typeparam>
|
||||
public class EmailTokenProvider<TUser>(EmailTokenProviderOptions options) : TotpSecurityStampBasedTokenProvider<TUser>
|
||||
public class EmailTokenProvider<TUser> : TotpSecurityStampBasedTokenProvider<TUser>
|
||||
where TUser : class
|
||||
{
|
||||
public EmailTokenProvider(EmailTokenProviderOptions options)
|
||||
{
|
||||
Options = options;
|
||||
}
|
||||
|
||||
|
||||
public EmailTokenProvider() : this(new EmailTokenProviderOptions()) { }
|
||||
|
||||
public EmailTokenProviderOptions Options { get; } = options;
|
||||
public EmailTokenProviderOptions Options { get; private set; }
|
||||
|
||||
public override string Name { get { return Options.Name; } }
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,14 @@ using System.Security.Claims;
|
|||
|
||||
namespace Microsoft.AspNet.Identity
|
||||
{
|
||||
public class ExternalLoginInfo(ClaimsIdentity externalIdentity, string loginProvider, string providerKey,
|
||||
string displayName) : UserLoginInfo(loginProvider, providerKey, displayName)
|
||||
public class ExternalLoginInfo : UserLoginInfo
|
||||
{
|
||||
public ClaimsIdentity ExternalIdentity { get; set; } = externalIdentity;
|
||||
public ExternalLoginInfo(ClaimsIdentity externalIdentity, string loginProvider, string providerKey,
|
||||
string displayName) : base(loginProvider, providerKey, displayName)
|
||||
{
|
||||
ExternalIdentity = externalIdentity;
|
||||
}
|
||||
|
||||
public ClaimsIdentity ExternalIdentity { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -33,8 +33,10 @@ namespace Microsoft.AspNet.Identity
|
|||
/// Represents a Role entity
|
||||
/// </summary>
|
||||
/// <typeparam name="TKey"></typeparam>
|
||||
public class IdentityRole<TKey>() where TKey : IEquatable<TKey>
|
||||
public class IdentityRole<TKey> where TKey : IEquatable<TKey>
|
||||
{
|
||||
public IdentityRole() { }
|
||||
|
||||
/// <summary>
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@ namespace Microsoft.AspNet.Identity
|
|||
}
|
||||
}
|
||||
|
||||
public class IdentityUser<TKey>() where TKey : IEquatable<TKey>
|
||||
public class IdentityUser<TKey> where TKey : IEquatable<TKey>
|
||||
{
|
||||
public IdentityUser() { }
|
||||
|
||||
public IdentityUser(string userName) : this()
|
||||
{
|
||||
UserName = userName;
|
||||
|
|
|
|||
|
|
@ -19,12 +19,18 @@ namespace Microsoft.AspNet.Identity
|
|||
/// TokenProvider that generates tokens from the user's security stamp and notifies a user via their phone number
|
||||
/// </summary>
|
||||
/// <typeparam name="TUser"></typeparam>
|
||||
public class PhoneNumberTokenProvider<TUser>(PhoneNumberTokenProviderOptions options) : TotpSecurityStampBasedTokenProvider<TUser>
|
||||
public class PhoneNumberTokenProvider<TUser> : TotpSecurityStampBasedTokenProvider<TUser>
|
||||
where TUser : class
|
||||
{
|
||||
public PhoneNumberTokenProvider(PhoneNumberTokenProviderOptions options)
|
||||
{
|
||||
Options = options;
|
||||
}
|
||||
|
||||
|
||||
public PhoneNumberTokenProvider() : this(new PhoneNumberTokenProviderOptions()) { }
|
||||
|
||||
public PhoneNumberTokenProviderOptions Options { get; } = options;
|
||||
public PhoneNumberTokenProviderOptions Options { get; private set; }
|
||||
|
||||
public override string Name { get { return Options.Name; } }
|
||||
|
||||
|
|
|
|||
|
|
@ -6,21 +6,28 @@ namespace Microsoft.AspNet.Identity
|
|||
/// <summary>
|
||||
/// Represents a linked login for a user (i.e. a local username/password or a facebook/google account
|
||||
/// </summary>
|
||||
public class UserLoginInfo(string loginProvider, string providerKey, string displayName)
|
||||
public class UserLoginInfo
|
||||
{
|
||||
public UserLoginInfo(string loginProvider, string providerKey, string displayName)
|
||||
{
|
||||
LoginProvider = loginProvider;
|
||||
ProviderKey = providerKey;
|
||||
ProviderDisplayName = displayName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provider for the linked login, i.e. Local, Facebook, Google, etc.
|
||||
/// </summary>
|
||||
public string LoginProvider { get; set; } = loginProvider;
|
||||
public string LoginProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Key for the linked login at the provider
|
||||
/// </summary>
|
||||
public string ProviderKey { get; set; } = providerKey;
|
||||
public string ProviderKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Display name for the provider
|
||||
/// </summary>
|
||||
public string ProviderDisplayName { get; set; } = displayName;
|
||||
public string ProviderDisplayName { get; set; }
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue