Merge branch 'release' into dev

This commit is contained in:
Cesar Blum Silveira 2015-11-11 11:03:39 -08:00
commit 89a9acea96
33 changed files with 837 additions and 390 deletions

View File

@ -8,43 +8,101 @@ using Microsoft.Data.Entity.Metadata;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// Base class for the Entity Framework database context used for identity.
/// </summary>
public class IdentityDbContext : IdentityDbContext<IdentityUser, IdentityRole, string> { }
/// <summary>
/// Base class for the Entity Framework database context used for identity.
/// </summary>
/// <typeparam name="TUser">The type of the user objects.</typeparam>
public class IdentityDbContext<TUser> : IdentityDbContext<TUser, IdentityRole, string> where TUser : IdentityUser
{ }
/// <summary>
/// Base class for the Entity Framework database context used for identity.
/// </summary>
/// <typeparam name="TUser">The type of user objects.</typeparam>
/// <typeparam name="TRole">The type of role objects.</typeparam>
/// <typeparam name="TKey">The type of the primary key for users and roles.</typeparam>
public class IdentityDbContext<TUser, TRole, TKey> : DbContext
where TUser : IdentityUser<TKey>
where TRole : IdentityRole<TKey>
where TKey : IEquatable<TKey>
{
/// <summary>
/// Initializes a new instance of <see cref="IdentityDbContext"/>.
/// </summary>
/// <param name="options">The options to be used by a <see cref="DbContext"/>.</param>
public IdentityDbContext(DbContextOptions options) : base(options)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IdentityDbContext" /> class using an <see cref="IServiceProvider" />.
/// </summary>
/// <param name="serviceProvider"> The service provider to be used.</param>
public IdentityDbContext(IServiceProvider serviceProvider) : base(serviceProvider)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IdentityDbContext" /> class using an <see cref="IServiceProvider" />.
/// </summary>
/// <param name="options">The options to be used by a <see cref="DbContext"/>.</param>
/// <param name="serviceProvider"> The service provider to be used.</param>
public IdentityDbContext(IServiceProvider serviceProvider, DbContextOptions options) : base(serviceProvider, options)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="IdentityDbContext" /> class.
/// </summary>
protected IdentityDbContext()
{
}
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of Users.
/// </summary>
public DbSet<TUser> Users { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User claims.
/// </summary>
public DbSet<IdentityUserClaim<TKey>> UserClaims { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User logins.
/// </summary>
public DbSet<IdentityUserLogin<TKey>> UserLogins { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of User roles.
/// </summary>
public DbSet<IdentityUserRole<TKey>> UserRoles { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of roles.
/// </summary>
public DbSet<TRole> Roles { get; set; }
/// <summary>
/// Gets or sets the <see cref="DbSet{TEntity}"/> of role claims.
/// </summary>
public DbSet<IdentityRoleClaim<TKey>> RoleClaims { get; set; }
/// <summary>
/// Configures the schema needed for the identity framework.
/// </summary>
/// <param name="builder">
/// The builder being used to construct the model for this context.
/// </param>
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<TUser>(b =>

View File

@ -3,6 +3,7 @@
using System;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Data.Entity;
using Microsoft.Extensions.DependencyInjection.Extensions;
@ -10,19 +11,57 @@ namespace Microsoft.Extensions.DependencyInjection
{
public static class IdentityEntityFrameworkBuilderExtensions
{
/// <summary>
/// Adds an Entity Framework implementation of identity information stores.
/// </summary>
/// <typeparam name="TContext">The Entity Framework database context to use.</typeparam>
/// <param name="builder">The <see cref="IdentityBuilder"/> instance this method extends.</param>
/// <returns>The <see cref="IdentityBuilder"/> instance this method extends.</returns>
public static IdentityBuilder AddEntityFrameworkStores<TContext>(this IdentityBuilder builder)
where TContext : DbContext
{
builder.Services.TryAdd(IdentityEntityFrameworkServices.GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext)));
builder.Services.TryAdd(GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext)));
return builder;
}
/// <summary>
/// Adds an Entity Framework implementation of identity information stores.
/// </summary>
/// <typeparam name="TContext">The Entity Framework database context to use.</typeparam>
/// <typeparam name="TKey">The type of the primary key used for the users and roles.</typeparam>
/// <param name="builder">The <see cref="IdentityBuilder"/> instance this method extends.</param>
/// <returns>The <see cref="IdentityBuilder"/> instance this method extends.</returns>
public static IdentityBuilder AddEntityFrameworkStores<TContext, TKey>(this IdentityBuilder builder)
where TContext : DbContext
where TKey : IEquatable<TKey>
{
builder.Services.TryAdd(IdentityEntityFrameworkServices.GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext), typeof(TKey)));
builder.Services.TryAdd(GetDefaultServices(builder.UserType, builder.RoleType, typeof(TContext), typeof(TKey)));
return builder;
}
private static IServiceCollection GetDefaultServices(Type userType, Type roleType, Type contextType, Type keyType = null)
{
Type userStoreType;
Type roleStoreType;
if (keyType != null)
{
userStoreType = typeof(UserStore<,,,>).MakeGenericType(userType, roleType, contextType, keyType);
roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, contextType, keyType);
}
else
{
userStoreType = typeof(UserStore<,,>).MakeGenericType(userType, roleType, contextType);
roleStoreType = typeof(RoleStore<,>).MakeGenericType(roleType, contextType);
}
var services = new ServiceCollection();
services.AddScoped(
typeof(IUserStore<>).MakeGenericType(userType),
userStoreType);
services.AddScoped(
typeof(IRoleStore<>).MakeGenericType(roleType),
roleStoreType);
return services;
}
}
}

View File

@ -1,41 +0,0 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.AspNet.Identity
{
/// <summary>
/// Default services
/// </summary>
public class IdentityEntityFrameworkServices
{
public static IServiceCollection GetDefaultServices(Type userType, Type roleType, Type contextType, Type keyType = null)
{
Type userStoreType;
Type roleStoreType;
if (keyType != null)
{
userStoreType = typeof(UserStore<,,,>).MakeGenericType(userType, roleType, contextType, keyType);
roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, contextType, keyType);
}
else
{
userStoreType = typeof(UserStore<,,>).MakeGenericType(userType, roleType, contextType);
roleStoreType = typeof(RoleStore<,>).MakeGenericType(roleType, contextType);
}
var services = new ServiceCollection();
services.AddScoped(
typeof(IUserStore<>).MakeGenericType(userType),
userStoreType);
services.AddScoped(
typeof(IRoleStore<>).MakeGenericType(roleType),
roleStoreType);
return services;
}
}
}

View File

@ -7,22 +7,28 @@ using System.Collections.Generic;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// Represents a Role entity
/// The default implementation of <see cref="IdentityRole{TKey}"/> which uses a string as the primary key.
/// </summary>
public class IdentityRole : IdentityRole<string>
{
/// <summary>
/// Constructor
/// Initializes a new instance of <see cref="IdentityRole"/>.
/// </summary>
/// <remarks>
/// The Id property is initialized to from a new GUID string value.
/// </remarks>
public IdentityRole()
{
Id = Guid.NewGuid().ToString();
}
/// <summary>
/// Constructor
/// Initializes a new instance of <see cref="IdentityRole"/>.
/// </summary>
/// <param name="roleName"></param>
/// <param name="roleName">The role name.</param>
/// <remarks>
/// The Id property is initialized to from a new GUID string value.
/// </remarks>
public IdentityRole(string roleName) : this()
{
Name = roleName;
@ -30,41 +36,48 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Represents a Role entity
/// Represents a role in the identity system
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TKey">The type used for the primary key for the role.</typeparam>
public class IdentityRole<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// Initializes a new instance of <see cref="IdentityRole{TKey}"/>.
/// </summary>
public IdentityRole() { }
/// <summary>
/// Constructor
/// Initializes a new instance of <see cref="IdentityRole{TKey}"/>.
/// </summary>
/// <param name="roleName"></param>
/// <param name="roleName">The role name.</param>
public IdentityRole(string roleName) : this()
{
Name = roleName;
}
/// <summary>
/// Navigation property for users in the role
/// Navigation property for the users in this role.
/// </summary>
public virtual ICollection<IdentityUserRole<TKey>> Users { get; } = new List<IdentityUserRole<TKey>>();
/// <summary>
/// Navigation property for claims in the role
/// Navigation property for claims in this role.
/// </summary>
public virtual ICollection<IdentityRoleClaim<TKey>> Claims { get; } = new List<IdentityRoleClaim<TKey>>();
/// <summary>
/// Role id
/// Gets or sets the primary key for this role.
/// </summary>
public virtual TKey Id { get; set; }
/// <summary>
/// Role name
/// Gets or sets the name for this role.
/// </summary>
public virtual string Name { get; set; }
/// <summary>
/// Gets or sets the normalized name for this role.
/// </summary>
public virtual string NormalizedName { get; set; }
/// <summary>
@ -73,9 +86,9 @@ namespace Microsoft.AspNet.Identity.EntityFramework
public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// Returns a friendly name
/// Returns the name of the role.
/// </summary>
/// <returns></returns>
/// <returns>The name of the role.</returns>
public override string ToString()
{
return Name;

View File

@ -6,28 +6,28 @@ using System;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// EntityType that represents one specific role claim
/// Represents a claim that is granted to all users within a role.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TKey">The type of the primary key of the role associated with this claim.</typeparam>
public class IdentityRoleClaim<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// Primary key
/// Gets or sets the identifier for this role claim.
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// User Id for the role this claim belongs to
/// Gets or sets the of the primary key of the role associated with this claim.
/// </summary>
public virtual TKey RoleId { get; set; }
/// <summary>
/// Claim type
/// Gets or sets the claim type for this claim.
/// </summary>
public virtual string ClaimType { get; set; }
/// <summary>
/// Claim value
/// Gets or sets the claim value for this claim.
/// </summary>
public virtual string ClaimValue { get; set; }
}

View File

@ -6,108 +6,155 @@ using System.Collections.Generic;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// The default implementation of <see cref="IdentityUser{TKey}"/> which uses a string as a primary key.
/// </summary>
public class IdentityUser : IdentityUser<string>
{
/// <summary>
/// Initializes a new instance of <see cref="IdentityUser"/>.
/// </summary>
/// <remarks>
/// The Id property is initialized to from a new GUID string value.
/// </remarks>
public IdentityUser()
{
Id = Guid.NewGuid().ToString();
}
/// <summary>
/// Initializes a new instance of <see cref="IdentityUser"/>.
/// </summary>
/// <param name="userName">The user name.</param>
/// <remarks>
/// The Id property is initialized to from a new GUID string value.
/// </remarks>
public IdentityUser(string userName) : this()
{
UserName = userName;
}
}
/// <summary>
/// Represents a user in the identity system
/// </summary>
/// <typeparam name="TKey">The type used for the primary key for the user.</typeparam>
public class IdentityUser<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// Initializes a new instance of <see cref="IdentityUser{TKey}"/>.
/// </summary>
public IdentityUser() { }
/// <summary>
/// Initializes a new instance of <see cref="IdentityUser{TKey}"/>.
/// </summary>
/// <param name="userName">The user name.</param>
public IdentityUser(string userName) : this()
{
UserName = userName;
}
/// <summary>
/// </summary>
/// Gets or sets the primary key for this user.
public virtual TKey Id { get; set; }
/// <summary>
/// Gets or sets the user name for this user.
/// </summary>
public virtual string UserName { get; set; }
/// <summary>
/// Gets or sets the normalized user name for this user.
/// </summary>
public virtual string NormalizedUserName { get; set; }
/// <summary>
/// Email
/// Gets or sets the email address for this user.
/// </summary>
public virtual string Email { get; set; }
/// <summary>
/// Gets or sets the normalized email address for this user.
/// </summary>
public virtual string NormalizedEmail { get; set; }
/// <summary>
/// True if the email is confirmed, default is false
/// Gets or sets a flag indicating if a user has confirmed their email address.
/// </summary>
/// <value>True if the email address has been confirmed, otherwise false.</value>
public virtual bool EmailConfirmed { get; set; }
/// <summary>
/// The salted/hashed form of the user password
/// Gets or sets a salted and hashed representation of the password for this user.
/// </summary>
public virtual string PasswordHash { get; set; }
/// <summary>
/// A random value that should change whenever a users credentials change (password changed, login removed)
/// A random value that must change whenever a users credentials change (password changed, login removed)
/// </summary>
public virtual string SecurityStamp { get; set; }
/// <summary>
/// A random value that should change whenever a user is persisted to the store
/// A random value that must change whenever a user is persisted to the store
/// </summary>
public virtual string ConcurrencyStamp { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// PhoneNumber for the user
/// Gets or sets a telephone number for the user.
/// </summary>
public virtual string PhoneNumber { get; set; }
/// <summary>
/// True if the phone number is confirmed, default is false
/// Gets or sets a flag indicating if a user has confirmed their telephone address.
/// </summary>
/// <value>True if the telephone number has been confirmed, otherwise false.</value>
public virtual bool PhoneNumberConfirmed { get; set; }
/// <summary>
/// Is two factor enabled for the user
/// Gets or sets a flag indicating if two factor authentication is enabled for this user.
/// </summary>
/// <value>True if 2fa is enabled, otherwise false.</value>
public virtual bool TwoFactorEnabled { get; set; }
/// <summary>
/// DateTime in UTC when lockout ends, any time in the past is considered not locked out.
/// Gets or sets the date and time, in UTC, when any user lockout ends.
/// </summary>
/// <remarks>
/// A value in the past means the user is not locked out.
/// </remarks>
public virtual DateTimeOffset? LockoutEnd { get; set; }
/// <summary>
/// Is lockout enabled for this user
/// Gets or sets a flag indicating if this user is locked out.
/// </summary>
/// <value>True if the user is locked out, otherwise false.</value>
public virtual bool LockoutEnabled { get; set; }
/// <summary>
/// Used to record failures for the purposes of lockout
/// Gets or sets the number of failed login attempts for the current user.
/// </summary>
public virtual int AccessFailedCount { get; set; }
/// <summary>
/// Navigation property for users in the role
/// Navigation property for the roles this user belongs to.
/// </summary>
public virtual ICollection<IdentityUserRole<TKey>> Roles { get; } = new List<IdentityUserRole<TKey>>();
/// <summary>
/// Navigation property for users claims
/// Navigation property for the claims this user possesses.
/// </summary>
public virtual ICollection<IdentityUserClaim<TKey>> Claims { get; } = new List<IdentityUserClaim<TKey>>();
/// <summary>
/// Navigation property for users logins
/// Navigation property for this users login accounts.
/// </summary>
public virtual ICollection<IdentityUserLogin<TKey>> Logins { get; } = new List<IdentityUserLogin<TKey>>();
/// <summary>
/// Returns a friendly name
/// Returns the username for this user.
/// </summary>
/// <returns></returns>
public override string ToString()
{
return UserName;

View File

@ -6,28 +6,28 @@ using System;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// EntityType that represents one specific user claim
/// Represents a claim that a user possesses.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TKey">The type used for the primary key for this user that possesses this claim.</typeparam>
public class IdentityUserClaim<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// Primary key
/// Gets or sets the identifier for this user claim.
/// </summary>
public virtual int Id { get; set; }
/// <summary>
/// User Id for the user who owns this claim
/// Gets or sets the of the primary key of the user associated with this claim.
/// </summary>
public virtual TKey UserId { get; set; }
/// <summary>
/// Claim type
/// Gets or sets the claim type for this claim.
/// </summary>
public virtual string ClaimType { get; set; }
/// <summary>
/// Claim value
/// Gets or sets the claim value for this claim.
/// </summary>
public virtual string ClaimValue { get; set; }
}

View File

@ -6,28 +6,28 @@ using System;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// Entity type for a user's login (i.e. facebook, google)
/// Represents a login and its associated provider for a user.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TKey">The type of the primary key of the user associated with this login.</typeparam>
public class IdentityUserLogin<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// The login provider for the login (i.e. facebook, google)
/// Gets or sets the login provider for the login (e.g. facebook, google)
/// </summary>
public virtual string LoginProvider { get; set; }
/// <summary>
/// Key representing the login for the provider
/// Gets or sets the unique provider identifier for this login.
/// </summary>
public virtual string ProviderKey { get; set; }
/// <summary>
/// Display name for the login
/// Gets or sets the friendly name used in a UI for this login.
/// </summary>
public virtual string ProviderDisplayName { get; set; }
/// <summary>
/// User Id for the user who owns this login
/// Gets or sets the of the primary key of the user associated with this login.
/// </summary>
public virtual TKey UserId { get; set; }
}

View File

@ -6,18 +6,18 @@ using System;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// EntityType that represents a user belonging to a role
/// Represents the link between a user and a role.
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TKey">The type of the primary key used for users and roles.</typeparam>
public class IdentityUserRole<TKey> where TKey : IEquatable<TKey>
{
/// <summary>
/// UserId for the user that is in the role
/// Gets or sets the primary key of the user that is linked to a role.
/// </summary>
public virtual TKey UserId { get; set; }
/// <summary>
/// RoleId for the role
/// Gets or sets the primary key of the role that is linked to the user.
/// </summary>
public virtual TKey RoleId { get; set; }
}

View File

@ -9,16 +9,24 @@ using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Update;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// Creates a new instance of a persistence store for roles.
/// </summary>
/// <typeparam name="TRole">The type of the class representing a role</typeparam>
public class RoleStore<TRole> : RoleStore<TRole, DbContext, string>
where TRole : IdentityRole<string>
{
public RoleStore(DbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}
/// <summary>
/// Creates a new instance of a persistence store for roles.
/// </summary>
/// <typeparam name="TRole">The type of the class representing a role.</typeparam>
/// <typeparam name="TContext">The type of the data context class used to access the store.</typeparam>
public class RoleStore<TRole, TContext> : RoleStore<TRole, TContext, string>
where TRole : IdentityRole<string>
where TContext : DbContext
@ -26,6 +34,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
public RoleStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}
/// <summary>
/// Creates a new instance of a persistence store for roles.
/// </summary>
/// <typeparam name="TRole">The type of the class representing a role.</typeparam>
/// <typeparam name="TContext">The type of the data context class used to access the store.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a role.</typeparam>
public class RoleStore<TRole, TContext, TKey> :
IQueryableRoleStore<TRole>,
IRoleClaimStore<TRole>
@ -46,18 +60,27 @@ namespace Microsoft.AspNet.Identity.EntityFramework
private bool _disposed;
/// <summary>
/// Gets the database context for this store.
/// </summary>
public TContext Context { get; private set; }
/// <summary>
/// Used to generate public API error messages
/// Gets or sets the <see cref="IdentityErrorDescriber"/> for any error that occurred with the current operation.
/// </summary>
public IdentityErrorDescriber ErrorDescriber { get; set; }
/// <summary>
/// If true will call SaveChanges after CreateAsync/UpdateAsync/DeleteAsync
/// Gets or sets a flag indicating if changes should be persisted after CreateAsync, UpdateAsync and DeleteAsync are called.
/// </summary>
/// <value>
/// True if changes should be automatically persisted, otherwise false.
/// </value>
public bool AutoSaveChanges { get; set; } = true;
/// <summary>Saves the current store.</summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
private async Task SaveChanges(CancellationToken cancellationToken)
{
if (AutoSaveChanges)
@ -66,6 +89,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
}
/// <summary>
/// Creates a new role in a store as an asynchronous operation.
/// </summary>
/// <param name="role">The role to create in the store.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that represents the <see cref="IdentityResult"/> of the asynchronous query.</returns>
public async virtual Task<IdentityResult> CreateAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -79,6 +108,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return IdentityResult.Success;
}
/// <summary>
/// Updates a role in a store as an asynchronous operation.
/// </summary>
/// <param name="role">The role to update in the store.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that represents the <see cref="IdentityResult"/> of the asynchronous query.</returns>
public async virtual Task<IdentityResult> UpdateAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -101,6 +136,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return IdentityResult.Success;
}
/// <summary>
/// Deletes a role from the store as an asynchronous operation.
/// </summary>
/// <param name="role">The role to delete from the store.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that represents the <see cref="IdentityResult"/> of the asynchronous query.</returns>
public async virtual Task<IdentityResult> DeleteAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -121,6 +162,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return IdentityResult.Success;
}
/// <summary>
/// Gets the ID for a role from the store as an asynchronous operation.
/// </summary>
/// <param name="role">The role whose ID should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the ID of the role.</returns>
public Task<string> GetRoleIdAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -132,6 +179,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(ConvertIdToString(role.Id));
}
/// <summary>
/// Gets the name of a role from the store as an asynchronous operation.
/// </summary>
/// <param name="role">The role whose name should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the name of the role.</returns>
public Task<string> GetRoleNameAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -143,6 +196,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(role.Name);
}
/// <summary>
/// Sets the name of a role in the store as an asynchronous operation.
/// </summary>
/// <param name="role">The role whose name should be set.</param>
/// <param name="roleName">The name of the role.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public Task SetRoleNameAsync(TRole role, string roleName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -155,6 +215,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(0);
}
/// <summary>
/// Converts the provided <paramref name="id"/> to a strongly typed key object.
/// </summary>
/// <param name="id">The id to convert.</param>
/// <returns>An instance of <typeparamref name="TKey"/> representing the provided <paramref name="id"/>.</returns>
public virtual TKey ConvertIdFromString(string id)
{
if (id == null)
@ -164,6 +229,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return (TKey)TypeDescriptor.GetConverter(typeof(TKey)).ConvertFromInvariantString(id);
}
/// <summary>
/// Converts the provided <paramref name="id"/> to its string representation.
/// </summary>
/// <param name="id">The id to convert.</param>
/// <returns>An <see cref="string"/> representation of the provided <paramref name="id"/>.</returns>
public virtual string ConvertIdToString(TKey id)
{
if (id.Equals(default(TKey)))
@ -174,11 +244,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Find a role by id
/// Finds the role who has the specified ID as an asynchronous operation.
/// </summary>
/// <param name="id"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="roleId">The role ID to look for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that result of the look up.</returns>
public virtual Task<TRole> FindByIdAsync(string id, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -188,11 +258,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Find a role by normalized name
/// Finds the role who has the specified normalized name as an asynchronous operation.
/// </summary>
/// <param name="normalizedName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="normalizedRoleName">The normalized role name to look for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that result of the look up.</returns>
public virtual Task<TRole> FindByNameAsync(string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -200,6 +270,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Roles.FirstOrDefaultAsync(r => r.NormalizedName == normalizedName, cancellationToken);
}
/// <summary>
/// Get a role's normalized name as an asynchronous operation.
/// </summary>
/// <param name="role">The role whose normalized name should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the name of the role.</returns>
public virtual Task<string> GetNormalizedRoleNameAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -211,6 +287,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(role.NormalizedName);
}
/// <summary>
/// Set a role's normalized name as an asynchronous operation.
/// </summary>
/// <param name="role">The role whose normalized name should be set.</param>
/// <param name="normalizedName">The normalized name to set</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetNormalizedRoleNameAsync(TRole role, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -232,13 +315,19 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Dispose the store
/// Dispose the stores
/// </summary>
public void Dispose()
{
_disposed = true;
}
/// <summary>
/// Get the claims associated with the specified <paramref name="role"/> as an asynchronous operation.
/// </summary>
/// <param name="role">The role whose claims should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the claims granted to a role.</returns>
public async Task<IList<Claim>> GetClaimsAsync(TRole role, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -250,6 +339,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return await RoleClaims.Where(rc => rc.RoleId.Equals(role.Id)).Select(c => new Claim(c.ClaimType, c.ClaimValue)).ToListAsync(cancellationToken);
}
/// <summary>
/// Adds the <paramref name="claim"/> given to the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role to add the claim to.</param>
/// <param name="claim">The claim to add to the role.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public Task AddClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -267,6 +363,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(false);
}
/// <summary>
/// Removes the <paramref name="claim"/> given from the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role to remove the claim from.</param>
/// <param name="claim">The claim to remove from the role.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public async Task RemoveClaimAsync(TRole role, Claim claim, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -285,6 +388,9 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
}
/// <summary>
/// A navigation property for the roles the store contains.
/// </summary>
public virtual IQueryable<TRole> Roles
{
get { return Context.Set<TRole>(); }

View File

@ -10,21 +10,34 @@ using System.Security.Claims;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Update;
namespace Microsoft.AspNet.Identity.EntityFramework
{
/// <summary>
/// Creates a new instance of a persistence store for users, using the default implementation
/// of <see cref="IdentityUser{TKey}"/> with a string as a primary key.
/// </summary>
public class UserStore : UserStore<IdentityUser<string>>
{
public UserStore(DbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}
/// <summary>
/// Creates a new instance of a persistence store for the specified user type.
/// </summary>
/// <typeparam name="TUser">The type representing a user.</typeparam>
public class UserStore<TUser> : UserStore<TUser, IdentityRole, DbContext>
where TUser : IdentityUser<string>, new()
{
public UserStore(DbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}
/// <summary>
/// Creates a new instance of a persistence store for the specified user and role types.
/// </summary>
/// <typeparam name="TUser">The type representing a user.</typeparam>
/// <typeparam name="TRole">The type representing a role.</typeparam>
/// <typeparam name="TContext">The type of the data context class used to access the store.</typeparam>
public class UserStore<TUser, TRole, TContext> : UserStore<TUser, TRole, TContext, string>
where TUser : IdentityUser<string>, new()
where TRole : IdentityRole<string>, new()
@ -33,6 +46,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
public UserStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}
/// <summary>
/// Represents a new instance of a persistence store for the specified user and role types.
/// </summary>
/// <typeparam name="TUser">The type representing a user.</typeparam>
/// <typeparam name="TRole">The type representing a role.</typeparam>
/// <typeparam name="TContext">The type of the data context class used to access the store.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a role.</typeparam>
public class UserStore<TUser, TRole, TContext, TKey> :
IUserLoginStore<TUser>,
IUserRoleStore<TUser>,
@ -50,6 +70,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
where TKey : IEquatable<TKey>
{
/// <summary>
/// Creates a new instance of <see cref="UserStore"/>.
/// </summary>
/// <param name="context">The context used to access the store.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/> used to describe store errors.</param>
public UserStore(TContext context, IdentityErrorDescriber describer = null)
{
if (context == null)
@ -62,23 +87,38 @@ namespace Microsoft.AspNet.Identity.EntityFramework
private bool _disposed;
/// <summary>
/// Gets the database context for this store.
/// </summary>
public TContext Context { get; private set; }
/// <summary>
/// Used to generate public API error messages
/// Gets or sets the <see cref="IdentityErrorDescriber"/> for any error that occurred with the current operation.
/// </summary>
public IdentityErrorDescriber ErrorDescriber { get; set; }
/// <summary>
/// If true will call SaveChanges after CreateAsync/UpdateAsync/DeleteAsync
/// Gets or sets a flag indicating if changes should be persisted after CreateAsync, UpdateAsync and DeleteAsync are called.
/// </summary>
/// <value>
/// True if changes should be automatically persisted, otherwise false.
/// </value>
public bool AutoSaveChanges { get; set; } = true;
/// <summary>Saves the current store.</summary>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
private Task SaveChanges(CancellationToken cancellationToken)
{
return AutoSaveChanges ? Context.SaveChangesAsync(cancellationToken) : Task.FromResult(0);
}
/// <summary>
/// Gets the user identifier for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose identifier should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the identifier for the specified <paramref name="user"/>.</returns>
public virtual Task<string> GetUserIdAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -90,6 +130,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(ConvertIdToString(user.Id));
}
/// <summary>
/// Gets the user name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the name for the specified <paramref name="user"/>.</returns>
public virtual Task<string> GetUserNameAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -101,6 +147,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(user.UserName);
}
/// <summary>
/// Sets the given <paramref name="userName" /> for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be set.</param>
/// <param name="userName">The user name to set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetUserNameAsync(TUser user, string userName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -113,6 +166,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(0);
}
/// <summary>
/// Gets the normalized user name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose normalized name should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the normalized user name for the specified <paramref name="user"/>.</returns>
public virtual Task<string> GetNormalizedUserNameAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -124,6 +183,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(user.NormalizedUserName);
}
/// <summary>
/// Sets the given normalized name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be set.</param>
/// <param name="normalizedName">The normalized name to set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetNormalizedUserNameAsync(TUser user, string normalizedName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -136,6 +202,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(0);
}
/// <summary>
/// Creates the specified <paramref name="user"/> in the user store.
/// </summary>
/// <param name="user">The user to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the creation operation.</returns>
public async virtual Task<IdentityResult> CreateAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -149,6 +221,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return IdentityResult.Success;
}
/// <summary>
/// Updates the specified <paramref name="user"/> in the user store.
/// </summary>
/// <param name="user">The user to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
public async virtual Task<IdentityResult> UpdateAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -172,6 +250,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return IdentityResult.Success;
}
/// <summary>
/// Deletes the specified <paramref name="user"/> from the user store.
/// </summary>
/// <param name="user">The user to delete.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the update operation.</returns>
public async virtual Task<IdentityResult> DeleteAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -194,11 +278,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Find a user by id
/// Finds and returns a user, if any, who has the specified <paramref name="userId"/>.
/// </summary>
/// <param name="userId"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="userId">The user ID to search for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userID"/> if it exists.
/// </returns>
public virtual Task<TUser> FindByIdAsync(string userId, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -207,6 +293,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Users.FirstOrDefaultAsync(u => u.Id.Equals(id), cancellationToken);
}
/// <summary>
/// Converts the provided <paramref name="id"/> to a strongly typed key object.
/// </summary>
/// <param name="id">The id to convert.</param>
/// <returns>An instance of <typeparamref name="TKey"/> representing the provided <paramref name="id"/>.</returns>
public virtual TKey ConvertIdFromString(string id)
{
if (id == null)
@ -216,6 +307,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return (TKey)TypeDescriptor.GetConverter(typeof(TKey)).ConvertFromInvariantString(id);
}
/// <summary>
/// Converts the provided <paramref name="id"/> to its string representation.
/// </summary>
/// <param name="id">The id to convert.</param>
/// <returns>An <see cref="string"/> representation of the provided <paramref name="id"/>.</returns>
public virtual string ConvertIdToString(TKey id)
{
if (id.Equals(default(TKey)))
@ -226,11 +322,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Find a user by normalized name
/// Finds and returns a user, if any, who has the specified normalized user name.
/// </summary>
/// <param name="userName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="normalizedUserName">The normalized user name to search for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, containing the user matching the specified <paramref name="userID"/> if it exists.
/// </returns>
public virtual Task<TUser> FindByNameAsync(string normalizedUserName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -238,18 +336,21 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Users.FirstOrDefaultAsync(u => u.NormalizedUserName == normalizedUserName, cancellationToken);
}
/// <summary>
/// A navigation property for the users the store contains.
/// </summary>
public virtual IQueryable<TUser> Users
{
get { return Context.Set<TUser>(); }
}
/// <summary>
/// Set the password hash for a user
/// Sets the password hash for a user.
/// </summary>
/// <param name="user"></param>
/// <param name="passwordHash"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user to set the password hash for.</param>
/// <param name="passwordHash">The password hash to set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetPasswordHashAsync(TUser user, string passwordHash, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -263,11 +364,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get the password hash for a user
/// Gets the password hash for a user.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user to retrieve the password hash for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the password hash for the user.</returns>
public virtual Task<string> GetPasswordHashAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -280,11 +381,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns true if the user has a password set
/// Returns a flag indicating if the specified user has a password.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user to retrieve the password hash for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> containing a flag indicating if the specified user has a password. If the
/// user has a password the returned value with be true, otherwise it will be false.</returns>
public virtual Task<bool> HasPasswordAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -292,12 +394,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Add a user to a role
/// Adds the given <paramref name="roleName"/> to the specified <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="roleName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user to add the role to.</param>
/// <param name="roleName">The role to add.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public async virtual Task AddToRoleAsync(TUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -306,7 +408,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework
{
throw new ArgumentNullException(nameof(user));
}
if (String.IsNullOrWhiteSpace(roleName))
if (string.IsNullOrWhiteSpace(roleName))
{
throw new ArgumentException(Resources.ValueCannotBeNullOrEmpty, nameof(roleName));
}
@ -320,12 +422,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Remove a user from a role
/// Removes the given <paramref name="roleName"/> from the specified <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="roleName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user to remove the role from.</param>
/// <param name="roleName">The role to remove.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public async virtual Task RemoveFromRoleAsync(TUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -334,7 +436,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework
{
throw new ArgumentNullException(nameof(user));
}
if (String.IsNullOrWhiteSpace(roleName))
if (string.IsNullOrWhiteSpace(roleName))
{
throw new ArgumentException(Resources.ValueCannotBeNullOrEmpty, nameof(roleName));
}
@ -350,11 +452,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get the names of the roles a user is a member of
/// Retrieves the roles the specified <paramref name="user"/> is a member of.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose roles should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the roles the user is a member of.</returns>
public virtual async Task<IList<string>> GetRolesAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -372,12 +474,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns true if the user is in the named role
/// Returns a flag indicating if the specified user is a member of the give <paramref name="roleName"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="roleName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose role membership should be checked.</param>
/// <param name="roleName">The role to check membership of</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> containing a flag indicating if the specified user is a member of the given group. If the
/// user is a member of the group the returned value with be true, otherwise it will be false.</returns>
public virtual async Task<bool> IsInRoleAsync(TUser user, string roleName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -409,7 +512,7 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Dispose the store
/// Dispose the store
/// </summary>
public void Dispose()
{
@ -421,6 +524,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
private DbSet<IdentityUserRole<TKey>> UserRoles { get { return Context.Set<IdentityUserRole<TKey>>(); } }
private DbSet<IdentityUserLogin<TKey>> UserLogins { get { return Context.Set<IdentityUserLogin<TKey>>(); } }
/// <summary>
/// Get the claims associated with the specified <paramref name="user"/> as an asynchronous operation.
/// </summary>
/// <param name="user">The user whose claims should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>A <see cref="Task{TResult}"/> that contains the claims granted to a user.</returns>
public async virtual Task<IList<Claim>> GetClaimsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -432,6 +541,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return await UserClaims.Where(uc => uc.UserId.Equals(user.Id)).Select(c => new Claim(c.ClaimType, c.ClaimValue)).ToListAsync(cancellationToken);
}
/// <summary>
/// Adds the <paramref name="claim"/> given to the specified <paramref name="user"/>.
/// </summary>
/// <param name="uuser">The user to add the claim to.</param>
/// <param name="claim">The claim to add to the user.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -450,6 +566,14 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(false);
}
/// <summary>
/// Replaces the <paramref name="claim"/> on the specified <paramref name="user"/>, with the <paramref name="newClaim"/>.
/// </summary>
/// <param name="user">The role to replace the claim on.</param>
/// <param name="claim">The claim replace.</param>
/// <param name="newClaim">The new claim replacing the <paramref name="claim"/>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public async virtual Task ReplaceClaimAsync(TUser user, Claim claim, Claim newClaim, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -474,6 +598,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
}
/// <summary>
/// Removes the <paramref name="claims"/> given from the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to remove the claims from.</param>
/// <param name="claims">The claim to remove.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public async virtual Task RemoveClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken = default(CancellationToken))
{
ThrowIfDisposed();
@ -495,6 +626,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
}
/// <summary>
/// Adds the <paramref name=login"/> given to the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to add the login to.</param>
/// <param name="login">The login to add to the user.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task AddLoginAsync(TUser user, UserLoginInfo login,
CancellationToken cancellationToken = default(CancellationToken))
{
@ -520,6 +658,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(false);
}
/// <summary>
/// Removes the <paramref name=login"/> given from the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to remove the login from.</param>
/// <param name="login">The login to remove from the user.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual async Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey,
CancellationToken cancellationToken = default(CancellationToken))
{
@ -537,6 +682,14 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
}
/// <summary>
/// Retrieves the associated logins for the specified <param ref="user"/>.
/// </summary>
/// <param name="user">The user whose associated logins to retrieve.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> for the asynchronous operation, containing a list of <see cref="UserLoginInfo"/> for the specified <paramref name="user"/>, if any.
/// </returns>
public async virtual Task<IList<UserLoginInfo>> GetLoginsAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -550,6 +703,15 @@ namespace Microsoft.AspNet.Identity.EntityFramework
.Select(l => new UserLoginInfo(l.LoginProvider, l.ProviderKey, l.ProviderDisplayName)).ToListAsync(cancellationToken);
}
/// <summary>
/// Retrieves the user associated with the specified login provider and login provider key..
/// </summary>
/// <param name="loginProvider">The login provider who provided the <paramref name="providerKey"/>.</param>
/// <param name="providerKey">The key provided by the <paramref name="loginProvider"/> to identify a user.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> for the asynchronous operation, containing the user, if any which matched the specified login provider and key.
/// </returns>
public async virtual Task<TUser> FindByLoginAsync(string loginProvider, string providerKey,
CancellationToken cancellationToken = default(CancellationToken))
{
@ -565,11 +727,15 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns whether the user email is confirmed
/// Gets a flag indicating whether the email address for the specified <paramref name="user"/> has been verified, true if the email address is verified otherwise
/// false.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose email confirmation status should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The task object containing the results of the asynchronous operation, a flag indicating whether the email address for the specified <paramref name="user"/>
/// has been confirmed or not.
/// </returns>
public virtual Task<bool> GetEmailConfirmedAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -582,12 +748,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Set IsConfirmed on the user
/// Sets the flag indicating whether the specified <paramref name="user"/>'s email address has been confirmed or not.
/// </summary>
/// <param name="user"></param>
/// <param name="confirmed"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose email confirmation status should be set.</param>
/// <param name="confirmed">A flag indicating if the email address has been confirmed, true if the address is confirmed otherwise false.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The task object representing the asynchronous operation.</returns>
public virtual Task SetEmailConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -601,12 +767,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Set the user email
/// Sets the <paramref name="email"/> address for a <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="email"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose email should be set.</param>
/// <param name="email">The email to set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The task object representing the asynchronous operation.</returns>
public virtual Task SetEmailAsync(TUser user, string email, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -620,11 +786,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get the user's email
/// Gets the email address for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose email should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The task object containing the results of the asynchronous operation, the email address for the specified <paramref name="user"/>.</returns>
public virtual Task<string> GetEmailAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -636,6 +802,14 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(user.Email);
}
/// <summary>
/// Returns the normalized email for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email address to retrieve.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The task object containing the results of the asynchronous lookup operation, the normalized email address if any associated with the specified user.
/// </returns>
public virtual Task<string> GetNormalizedEmailAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -647,6 +821,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
return Task.FromResult(user.NormalizedEmail);
}
/// <summary>
/// Sets the normalized email for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email address to set.</param>
/// <param name="normalizedEmail">The normalized email to set for the specified <paramref name="user"/>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The task object representing the asynchronous operation.</returns>
public virtual Task SetNormalizedEmailAsync(TUser user, string normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -660,11 +841,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Find an user by email
/// Gets the user, if any, associated with the specified, normalized email address.
/// </summary>
/// <param name="email"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="normalizedEmail">The normalized email address to return the user for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The task object containing the results of the asynchronous lookup operation, the user if any associated with the specified normalized email address.
/// </returns>
public virtual Task<TUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -673,12 +856,15 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns the DateTimeOffset that represents the end of a user's lockout, any time in the past should be considered
/// not locked out.
/// Gets the last <see cref="DateTimeOffset"/> a user's last lockout expired, if any.
/// Any time in the past should be indicates a user is not locked out.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose lockout date should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// A <see cref="Task{TResult}"/> that represents the result of the asynchronous query, a <see cref="DateTimeOffset"/> containing the last time
/// a user's lockout expired, if any.
/// </returns>
public virtual Task<DateTimeOffset?> GetLockoutEndDateAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -691,12 +877,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Locks a user out until the specified end date (set to a past date, to unlock a user)
/// Locks out a user until the specified end date has passed. Setting a end date in the past immediately unlocks a user.
/// </summary>
/// <param name="user"></param>
/// <param name="lockoutEnd"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose lockout date should be set.</param>
/// <param name="lockoutEnd">The <see cref="DateTimeOffset"/> after which the <paramref name="user"/>'s lockout should end.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -710,11 +896,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Used to record when an attempt to access the user has failed
/// Records that a failed access has occurred, incrementing the failed access count.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose cancellation count should be incremented.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the incremented failed access count.</returns>
public virtual Task<int> IncrementAccessFailedCountAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -728,11 +914,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Used to reset the account access count, typically after the account is successfully accessed
/// Resets a user's failed access count.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose failed access count should be reset.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
/// <remarks>This is typically called after the account is successfully accessed.</remarks>
public virtual Task ResetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -746,12 +933,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns the current number of failed access attempts. This number usually will be reset whenever the password is
/// verified or the account is locked out.
/// Retrieves the current failed access count for the specified <paramref name="user"/>..
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose failed access count should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the failed access count.</returns>
public virtual Task<int> GetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -764,11 +950,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns whether the user can be locked out.
/// Retrieves a flag indicating whether user lockout can enabled for the specified user.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose ability to be locked out should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, true if a user can be locked out, otherwise false.
/// </returns>
public virtual Task<bool> GetLockoutEnabledAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -781,12 +969,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Sets whether the user can be locked out.
/// Set the flag indicating if the specified <paramref name="user"/> can be locked out..
/// </summary>
/// <param name="user"></param>
/// <param name="enabled"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose ability to be locked out should be set.</param>
/// <param name="enabled">A flag indicating if lock out can be enabled for the specified <paramref name="user"/>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetLockoutEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -800,12 +988,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Set the user's phone number
/// Sets the telephone number for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="phoneNumber"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose telephone number should be set.</param>
/// <param name="phoneNumber">The telephone number to set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetPhoneNumberAsync(TUser user, string phoneNumber, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -819,11 +1007,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get a user's phone number
/// Gets the telephone number, if any, for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose telephone number should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's telephone number, if any.</returns>
public virtual Task<string> GetPhoneNumberAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -836,11 +1024,14 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Returns whether the user phoneNumber is confirmed
/// Gets a flag indicating whether the specified <paramref name="user"/>'s telephone number has been confirmed.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user to return a flag for, indicating whether their telephone number is confirmed.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, returning true if the specified <paramref name="user"/> has a confirmed
/// telephone number otherwise false.
/// </returns>
public virtual Task<bool> GetPhoneNumberConfirmedAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -853,12 +1044,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Set PhoneNumberConfirmed on the user
/// Sets a flag indicating if the specified <paramref name="user"/>'s phone number has been confirmed..
/// </summary>
/// <param name="user"></param>
/// <param name="confirmed"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose telephone number confirmation status should be set.</param>
/// <param name="confirmed">A flag indicating whether the user's telephone number has been confirmed.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetPhoneNumberConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -872,12 +1063,12 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Set the security stamp for the user
/// Sets the provided security <paramref name="stamp"/> for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user"></param>
/// <param name="stamp"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose security stamp should be set.</param>
/// <param name="stamp">The security stamp to set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetSecurityStampAsync(TUser user, string stamp, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -891,11 +1082,11 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get the security stamp for a user
/// Get the security stamp for the specified <paramref name="user" />.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose security stamp should be set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the security stamp for the specified <paramref name="user"/>.</returns>
public virtual Task<string> GetSecurityStampAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -908,12 +1099,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Set whether two factor authentication is enabled for the user
/// Sets a flag indicating whether the specified <paramref name="user "/>has two factor authentication enabled or not,
/// as an asynchronous operation.
/// </summary>
/// <param name="user"></param>
/// <param name="enabled"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose two factor authentication enabled status should be set.</param>
/// <param name="enabled">A flag indicating whether the specified <paramref name="user"/> has two factor authentication enabled.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
public virtual Task SetTwoFactorEnabledAsync(TUser user, bool enabled, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -927,11 +1119,15 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Gets whether two factor authentication is enabled for the user
/// Returns a flag indicating whether the specified <paramref name="user "/>has two factor authentication enabled or not,
/// as an asynchronous operation.
/// </summary>
/// <param name="user"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="user">The user whose two factor authentication enabled status should be set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, containing a flag indicating whether the specified
/// <paramref name="user "/>has two factor authentication enabled or not.
/// </returns>
public virtual Task<bool> GetTwoFactorEnabledAsync(TUser user, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -944,11 +1140,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get all users with given claim
/// Retrieves all users with the specified claim.
/// </summary>
/// <param name="claim"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="claim">The claim whose users should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> contains a list of users, if any, that contain the specified claim.
/// </returns>
public async virtual Task<IList<TUser>> GetUsersForClaimAsync(Claim claim, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
@ -968,11 +1166,13 @@ namespace Microsoft.AspNet.Identity.EntityFramework
}
/// <summary>
/// Get all users in given role
/// Retrieves all users in the specified role.
/// </summary>
/// <param name="roleName"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
/// <param name="roleName">The role whose users should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
/// <returns>
/// The <see cref="Task"/> contains a list of users, if any, that are in the specified role.
/// </returns>
public async virtual Task<IList<TUser>> GetUsersInRoleAsync(string roleName, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();

View File

@ -1,6 +1,10 @@
{
"description": "ASP.NET Identity providers that use Entity Framework.",
"version": "3.0.0-*",
"compilationOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"repository": {
"type": "git",
"url": "git://github.com/aspnet/identity"

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserEmailStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Sets the <paramref name="email"/> address for a <paramref name="user"/>, as an asynchronous operation.
/// Sets the <paramref name="email"/> address for a <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email should be set.</param>
/// <param name="email">The email to set.</param>
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Identity
Task SetEmailAsync(TUser user, string email, CancellationToken cancellationToken);
/// <summary>
/// Gets the email address for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the email address for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -31,7 +31,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Gets a flag indicating whether the email address for the specified <paramref name="user"/> has been verified, true if the email address is verified otherwise
/// false, as an asynchronous operation.
/// false.
/// </summary>
/// <param name="user">The user whose email confirmation status should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -42,7 +42,7 @@ namespace Microsoft.AspNet.Identity
Task<bool> GetEmailConfirmedAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Sets the flag indicating whether the specified <paramref name="user"/>'s email address has been confirmed or not, as an asynchronous operation.
/// Sets the flag indicating whether the specified <paramref name="user"/>'s email address has been confirmed or not.
/// </summary>
/// <param name="user">The user whose email confirmation status should be set.</param>
/// <param name="confirmed">A flag indicating if the email address has been confirmed, true if the address is confirmed otherwise false.</param>
@ -51,7 +51,7 @@ namespace Microsoft.AspNet.Identity
Task SetEmailConfirmedAsync(TUser user, bool confirmed, CancellationToken cancellationToken);
/// <summary>
/// Gets the user, if any, associated with the specified, normalized email address, as an asynchronous operation.
/// Gets the user, if any, associated with the specified, normalized email address.
/// </summary>
/// <param name="normalizedEmail">The normalized email address to return the user for.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -61,7 +61,7 @@ namespace Microsoft.AspNet.Identity
Task<TUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken);
/// <summary>
/// Returns the normalized email for the specified <paramref name="user"/>, as an asynchronous operation.
/// Returns the normalized email for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email address to retrieve.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Identity
Task<string> GetNormalizedEmailAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Sets the normalized email for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the normalized email for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email address to set.</param>
/// <param name="normalizedEmail">The normalized email to set for the specified <paramref name="user"/>.</param>

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserLockoutStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Gets the last <see cref="DateTimeOffset"/> a user's last lockout expired, if any, as an asynchronous operation.
/// Gets the last <see cref="DateTimeOffset"/> a user's last lockout expired, if any.
/// Any time in the past should be indicates a user is not locked out.
/// </summary>
/// <param name="user">The user whose lockout date should be retrieved.</param>
@ -27,7 +27,7 @@ namespace Microsoft.AspNet.Identity
Task<DateTimeOffset?> GetLockoutEndDateAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Locks out a user until the specified end date has passed, as an asynchronous operation. Setting a end date in the past immediately unlocks a user.
/// Locks out a user until the specified end date has passed. Setting a end date in the past immediately unlocks a user.
/// </summary>
/// <param name="user">The user whose lockout date should be set.</param>
/// <param name="lockoutEnd">The <see cref="DateTimeOffset"/> after which the <paramref name="user"/>'s lockout should end.</param>
@ -36,7 +36,7 @@ namespace Microsoft.AspNet.Identity
Task SetLockoutEndDateAsync(TUser user, DateTimeOffset? lockoutEnd, CancellationToken cancellationToken);
/// <summary>
/// Records that a failed access has occurred, incrementing the failed access count, as an asynchronous operation.
/// Records that a failed access has occurred, incrementing the failed access count.
/// </summary>
/// <param name="user">The user whose cancellation count should be incremented.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Identity
Task<int> IncrementAccessFailedCountAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Resets a user's failed access count, as an asynchronous operation.
/// Resets a user's failed access count.
/// </summary>
/// <param name="user">The user whose failed access count should be reset.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -53,7 +53,7 @@ namespace Microsoft.AspNet.Identity
Task ResetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Retrieves the current failed access count for the specified <paramref name="user"/>, as an asynchronous operation..
/// Retrieves the current failed access count for the specified <paramref name="user"/>..
/// </summary>
/// <param name="user">The user whose failed access count should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -61,7 +61,7 @@ namespace Microsoft.AspNet.Identity
Task<int> GetAccessFailedCountAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Retrieves a flag indicating whether user lockout can enabled for the specified user, as an asynchronous operation.
/// Retrieves a flag indicating whether user lockout can enabled for the specified user.
/// </summary>
/// <param name="user">The user whose ability to be locked out should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -71,7 +71,7 @@ namespace Microsoft.AspNet.Identity
Task<bool> GetLockoutEnabledAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Set the flag indicating if the specified <paramref name="user"/> can be locked out, as an asynchronous operation..
/// Set the flag indicating if the specified <paramref name="user"/> can be locked out..
/// </summary>
/// <param name="user">The user whose ability to be locked out should be set.</param>
/// <param name="enabled">A flag indicating if lock out can be enabled for the specified <paramref name="user"/>.</param>

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserLoginStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Adds an external <see cref="UserLoginInfo"/> to the specified <paramref name="user"/>, as an asynchronous operation.
/// Adds an external <see cref="UserLoginInfo"/> to the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to add the login to.</param>
/// <param name="login">The external <see cref="UserLoginInfo"/> to add to the specified <paramref name="user"/>.</param>
@ -24,7 +24,7 @@ namespace Microsoft.AspNet.Identity
Task AddLoginAsync(TUser user, UserLoginInfo login, CancellationToken cancellationToken);
/// <summary>
/// Attempts to remove the provided login information from the specified <paramref name="user"/>, as an asynchronous operation.
/// Attempts to remove the provided login information from the specified <paramref name="user"/>.
/// and returns a flag indicating whether the removal succeed or not.
/// </summary>
/// <param name="user">The user to remove the login information from.</param>
@ -38,7 +38,7 @@ namespace Microsoft.AspNet.Identity
Task RemoveLoginAsync(TUser user, string loginProvider, string providerKey, CancellationToken cancellationToken);
/// <summary>
/// Retrieves the associated logins for the specified <param ref="user"/>, as an asynchronous operation.
/// Retrieves the associated logins for the specified <param ref="user"/>.
/// </summary>
/// <param name="user">The user whose associated logins to retrieve.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -48,7 +48,7 @@ namespace Microsoft.AspNet.Identity
Task<IList<UserLoginInfo>> GetLoginsAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Retrieves the user associated with the specified login provider and login provider key, as an asynchronous operation..
/// Retrieves the user associated with the specified login provider and login provider key..
/// </summary>
/// <param name="loginProvider">The login provider who provided the <paramref name="providerKey"/>.</param>
/// <param name="providerKey">The key provided by the <paramref name="loginProvider"/> to identify a user.</param>

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserPasswordStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Sets the password hash for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the password hash for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose password hash to set.</param>
/// <param name="passwordHash">The password hash to set.</param>
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Identity
Task SetPasswordHashAsync(TUser user, string passwordHash, CancellationToken cancellationToken);
/// <summary>
/// Gets the password hash for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the password hash for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose password hash to retrieve.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Identity
Task<string> GetPasswordHashAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Gets a flag indicating whether the specified <paramref name="user"/> has a password, as an asynchronous operation.
/// Gets a flag indicating whether the specified <paramref name="user"/> has a password.
/// </summary>
/// <param name="user">The user to return a flag for, indicating whether they have a password or not.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserPhoneNumberStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Sets the telephone number for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the telephone number for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose telephone number should be set.</param>
/// <param name="phoneNumber">The telephone number to set.</param>
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Identity
Task SetPhoneNumberAsync(TUser user, string phoneNumber, CancellationToken cancellationToken);
/// <summary>
/// Gets the telephone number, if any, for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the telephone number, if any, for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose telephone number should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Identity
Task<string> GetPhoneNumberAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Gets a flag indicating whether the specified <paramref name="user"/>'s telephone number has been confirmed, as an asynchronous operation.
/// Gets a flag indicating whether the specified <paramref name="user"/>'s telephone number has been confirmed.
/// </summary>
/// <param name="user">The user to return a flag for, indicating whether their telephone number is confirmed.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -41,7 +41,7 @@ namespace Microsoft.AspNet.Identity
Task<bool> GetPhoneNumberConfirmedAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Sets a flag indicating if the specified <paramref name="user"/>'s phone number has been confirmed, as an asynchronous operation..
/// Sets a flag indicating if the specified <paramref name="user"/>'s phone number has been confirmed..
/// </summary>
/// <param name="user">The user whose telephone number confirmation status should be set.</param>
/// <param name="confirmed">A flag indicating whether the user's telephone number has been confirmed.</param>

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserRoleStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Add a the specified <paramref name="user"/> to the named role, as an asynchronous operation.
/// Add a the specified <paramref name="user"/> to the named role.
/// </summary>
/// <param name="user">The user to add to the named role.</param>
/// <param name="roleName">The name of the role to add the user to.</param>
@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Identity
Task AddToRoleAsync(TUser user, string roleName, CancellationToken cancellationToken);
/// <summary>
/// Add a the specified <paramref name="user"/> from the named role, as an asynchronous operation.
/// Add a the specified <paramref name="user"/> from the named role.
/// </summary>
/// <param name="user">The user to remove the named role from.</param>
/// <param name="roleName">The name of the role to remove.</param>
@ -32,7 +32,7 @@ namespace Microsoft.AspNet.Identity
Task RemoveFromRoleAsync(TUser user, string roleName, CancellationToken cancellationToken);
/// <summary>
/// Gets a list of role names the specified <paramref name="user"/> belongs to, as an asynchronous operation.
/// Gets a list of role names the specified <paramref name="user"/> belongs to.
/// </summary>
/// <param name="user">The user whose role names to retrieve.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Identity
Task<IList<string>> GetRolesAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Returns a flag indicating whether the specified <paramref name="user"/> is a member of the give named role, as an asynchronous operation.
/// Returns a flag indicating whether the specified <paramref name="user"/> is a member of the give named role.
/// </summary>
/// <param name="user">The user whose role membership should be checked.</param>
/// <param name="roleName">The name of the role to be checked.</param>

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserSecurityStampStore<TUser> : IUserStore<TUser> where TUser : class
{
/// <summary>
/// Sets the provided security <paramref name="stamp"/> for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the provided security <paramref name="stamp"/> for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose security stamp should be set.</param>
/// <param name="stamp">The security stamp to set.</param>
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Identity
Task SetSecurityStampAsync(TUser user, string stamp, CancellationToken cancellationToken);
/// <summary>
/// Get the security stamp for the specified <paramref name="user" />, as an asynchronous operation.
/// Get the security stamp for the specified <paramref name="user" />.
/// </summary>
/// <param name="user">The user whose security stamp should be set.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>

View File

@ -14,7 +14,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserStore<TUser> : IDisposable where TUser : class
{
/// <summary>
/// Gets the user identifier for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the user identifier for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose identifier should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -22,7 +22,7 @@ namespace Microsoft.AspNet.Identity
Task<string> GetUserIdAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Gets the user name for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the user name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -30,7 +30,7 @@ namespace Microsoft.AspNet.Identity
Task<string> GetUserNameAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Sets the given <paramref name="userName" /> for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the given <paramref name="userName" /> for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be set.</param>
/// <param name="userName">The user name to set.</param>
@ -39,7 +39,7 @@ namespace Microsoft.AspNet.Identity
Task SetUserNameAsync(TUser user, string userName, CancellationToken cancellationToken);
/// <summary>
/// Gets the normalized user name for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the normalized user name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose normalized name should be retrieved.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -47,7 +47,7 @@ namespace Microsoft.AspNet.Identity
Task<string> GetNormalizedUserNameAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Sets the given normalized name for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the given normalized name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be set.</param>
/// <param name="normalizedName">The normalized name to set.</param>
@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Identity
Task SetNormalizedUserNameAsync(TUser user, string normalizedName, CancellationToken cancellationToken);
/// <summary>
/// Creates the specified <paramref name="user"/> in the user store, as an asynchronous operation.
/// Creates the specified <paramref name="user"/> in the user store.
/// </summary>
/// <param name="user">The user to create.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -64,7 +64,7 @@ namespace Microsoft.AspNet.Identity
Task<IdentityResult> CreateAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Updates the specified <paramref name="user"/> in the user store, as an asynchronous operation.
/// Updates the specified <paramref name="user"/> in the user store.
/// </summary>
/// <param name="user">The user to update.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Identity
Task<IdentityResult> UpdateAsync(TUser user, CancellationToken cancellationToken);
/// <summary>
/// Deletes the specified <paramref name="user"/> from the user store, as an asynchronous operation.
/// Deletes the specified <paramref name="user"/> from the user store.
/// </summary>
/// <param name="user">The user to delete.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>

View File

@ -12,7 +12,7 @@ namespace Microsoft.AspNet.Identity
public interface IUserTokenProvider<TUser> where TUser : class
{
/// <summary>
/// Generates a token for the specified <paramref name="ref"/> and <paramref name="purpose"/>, as an asynchronous operation.
/// Generates a token for the specified <paramref name="ref"/> and <paramref name="purpose"/>.
/// </summary>
/// <param name="purpose">The purpose the token will be used for.</param>
/// <param name="manager">The <see cref="UserManager{TUser}"/> that can be used to retrieve user properties.</param>
@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Returns a flag indicating whether the specified <paramref name="token"/> is valid for the given
/// <paramref name="user"/> and <paramref name="purpose"/>, as an asynchronous operation.
/// <paramref name="user"/> and <paramref name="purpose"/>.
/// </summary>
/// <param name="purpose">The purpose the token will be used for.</param>
/// <param name="token">The token to validate.</param>

View File

@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Identity
/// Adds an <see cref="IUserValidator"/> for the <seealso cref="UserType"/>.
/// </summary>
/// <typeparam name="T">The user type to validate.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddUserValidator<T>() where T : class
{
return AddScoped(typeof(IUserValidator<>).MakeGenericType(UserType), typeof(T));
@ -70,7 +70,7 @@ namespace Microsoft.AspNet.Identity
/// Adds an <see cref="IRoleValidator{TRole}"/> for the <seealso cref="RoleType"/>.
/// </summary>
/// <typeparam name="T">The role type to validate.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddRoleValidator<T>() where T : class
{
return AddScoped(typeof(IRoleValidator<>).MakeGenericType(RoleType), typeof(T));
@ -80,7 +80,7 @@ namespace Microsoft.AspNet.Identity
/// Adds an <see cref="IdentityErrorDescriber"/>.
/// </summary>
/// <typeparam name="T">The type of the error describer.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddErrorDescriber<TDescriber>() where TDescriber : IdentityErrorDescriber
{
Services.AddScoped<IdentityErrorDescriber, TDescriber>();
@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Identity
/// Adds an <see cref="IPasswordValidator{TUser}"/> for the <seealso cref="UserType"/>.
/// </summary>
/// <typeparam name="T">The user type whose password will be validated.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddPasswordValidator<T>() where T : class
{
return AddScoped(typeof(IPasswordValidator<>).MakeGenericType(UserType), typeof(T));
@ -101,7 +101,7 @@ namespace Microsoft.AspNet.Identity
/// Adds an <see cref="IUserStore{TUser}"/> for the <seealso cref="UserType"/>.
/// </summary>
/// <typeparam name="T">The user type whose password will be validated.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddUserStore<T>() where T : class
{
return AddScoped(typeof(IUserStore<>).MakeGenericType(UserType), typeof(T));
@ -111,7 +111,7 @@ namespace Microsoft.AspNet.Identity
/// Adds a <see cref="IRoleStore{TRole}"/> for the <seealso cref="RoleType"/>.
/// </summary>
/// <typeparam name="T">The role type held in the store.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddRoleStore<T>() where T : class
{
return AddScoped(typeof(IRoleStore<>).MakeGenericType(RoleType), typeof(T));
@ -122,7 +122,7 @@ namespace Microsoft.AspNet.Identity
/// </summary>
/// <typeparam name="TProvider">The type of the token provider to add.</typeparam>
/// <param name="providerName">The name of the provider to add.</param>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddTokenProvider<TProvider>(string providerName) where TProvider : class
{
return AddTokenProvider(providerName, typeof(TProvider));
@ -133,7 +133,7 @@ namespace Microsoft.AspNet.Identity
/// </summary>
/// <param name="providerName">The name of the provider to add.</param>
/// <param name="provider">The type of the <see cref="IUserTokenProvider{TUser}"/> to add.</param>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddTokenProvider(string providerName, Type provider)
{
if (!typeof(IUserTokenProvider<>).MakeGenericType(UserType).GetTypeInfo().IsAssignableFrom(provider.GetTypeInfo()))
@ -149,9 +149,10 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Adds the default token providers.
/// Adds the default token providers used to generate tokens for reset passwords, change email
/// and change telephone number operations, and for two factor authentication token generation.
/// </summary>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddDefaultTokenProviders()
{
var dataProtectionProviderType = typeof(DataProtectorTokenProvider<>).MakeGenericType(UserType);
@ -166,7 +167,7 @@ namespace Microsoft.AspNet.Identity
/// Adds a <see cref="UserManager{TUser}"/> for the <seealso cref="UserType"/>.
/// </summary>
/// <typeparam name="TUserManager">The type of the user manager to add.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddUserManager<TUserManager>() where TUserManager : class
{
var userManagerType = typeof(UserManager<>).MakeGenericType(UserType);
@ -184,7 +185,7 @@ namespace Microsoft.AspNet.Identity
/// Adds a <see cref="RoleManager{TRole}"/> for the <seealso cref="RoleType"/>.
/// </summary>
/// <typeparam name="TRoleManager">The type of the role manager to add.</typeparam>
/// <returns>The <see cref="IdentityBuilder"/>.</returns>
/// <returns>The current <see cref="IdentityBuilder"/> instance.</returns>
public virtual IdentityBuilder AddRoleManager<TRoleManager>() where TRoleManager : class
{
var managerType = typeof(RoleManager<>).MakeGenericType(RoleType);

View File

@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Returns a constant, provider and user unique modifier used for entropy in generated tokens from user information, as an asynchronous operation.
/// Returns a constant, provider and user unique modifier used for entropy in generated tokens from user information.
/// </summary>
/// <param name="purpose">The purpose the token will be generated for.</param>
/// <param name="manager">The <see cref="UserManager{TUser}"/> that can be used to retrieve user properties.</param>

View File

@ -5,9 +5,9 @@ using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.Test")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.EntityFramework.Test")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.EntityFramework.InMemory.Test")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.InMemory.Test")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.EntityFramework.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.EntityFramework.InMemory.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: InternalsVisibleTo("Microsoft.AspNet.Identity.InMemory.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")]

View File

@ -149,7 +149,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Creates the specified <paramref name="role"/> in the persistence store, as an asynchronous operation.
/// Creates the specified <paramref name="role"/> in the persistence store.
/// </summary>
/// <param name="role">The role to create.</param>
/// <returns>
@ -173,7 +173,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Updates the normalized name for the specified <paramref name="role"/>, as an asynchronous operation.
/// Updates the normalized name for the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role whose normalized name needs to be updated.</param>
/// <returns>
@ -186,7 +186,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Updates the specified <paramref name="role"/>, as an asynchronous operation.
/// Updates the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role to updated.</param>
/// <returns>
@ -204,7 +204,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Deletes the specified <paramref name="role"/>, as an asynchronous operation.
/// Deletes the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role to delete.</param>
/// <returns>
@ -222,7 +222,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets a flag indicating whether the specified <paramref name="roleName"/> exists, as an asynchronous operation.
/// Gets a flag indicating whether the specified <paramref name="roleName"/> exists.
/// </summary>
/// <param name="roleName">The role name whose existence should be checked.</param>
/// <returns>
@ -250,7 +250,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Finds the role associated with the specified <paramref name="roleId"/> if any, as an asynchronous operation.
/// Finds the role associated with the specified <paramref name="roleId"/> if any.
/// </summary>
/// <param name="roleId">The role ID whose role should be returned.</param>
/// <returns>
@ -264,7 +264,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the name of the specified <paramref name="role"/>, as an asynchronous operation.
/// Gets the name of the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role whose name should be retrieved.</param>
/// <returns>
@ -278,7 +278,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Sets the name of the specified <paramref name="role"/>, as an asynchronous operation.
/// Sets the name of the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role whose name should be set.</param>
/// <param name="name">The name to set.</param>
@ -296,7 +296,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the ID of the specified <paramref name="role"/>, as an asynchronous operation.
/// Gets the ID of the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role whose ID should be retrieved.</param>
/// <returns>
@ -310,7 +310,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Finds the role associated with the specified <paramref name="roleName"/> if any, as an asynchronous operation.
/// Finds the role associated with the specified <paramref name="roleName"/> if any.
/// </summary>
/// <param name="roleName">The name of the role to be returned.</param>
/// <returns>
@ -329,7 +329,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Adds a claim to a role, as an asynchronous operation.
/// Adds a claim to a role.
/// </summary>
/// <param name="role">The role to add the claim to.</param>
/// <param name="claim">The claim to add.</param>
@ -355,7 +355,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Removes a claim from a role, as an asynchronous operation.
/// Removes a claim from a role.
/// </summary>
/// <param name="role">The role to remove the claim from.</param>
/// <param name="claim">The claim to add.</param>
@ -377,7 +377,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets a list of claims associated with the specified <paramref name="role"/>, as an asynchronous operation.
/// Gets a list of claims associated with the specified <paramref name="role"/>.
/// </summary>
/// <param name="role">The role whose claims should be returned.</param>
/// <returns>

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNet.Identity
where TUser : class
{
/// <summary>
/// Generates a token for the specified <paramref name="ref"/> and <paramref name="purpose"/>, as an asynchronous operation.
/// Generates a token for the specified <paramref name="ref"/> and <paramref name="purpose"/>.
/// </summary>
/// <param name="purpose">The purpose the token will be used for.</param>
/// <param name="manager">The <see cref="UserManager{TUser}"/> that can be used to retrieve user properties.</param>
@ -44,7 +44,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Returns a flag indicating whether the specified <paramref name="token"/> is valid for the given
/// <paramref name="user"/> and <paramref name="purpose"/>, as an asynchronous operation.
/// <paramref name="user"/> and <paramref name="purpose"/>.
/// </summary>
/// <param name="purpose">The purpose the token will be used for.</param>
/// <param name="token">The token to validate.</param>
@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Returns a constant, provider and user unique modifier used for entropy in generated tokens from user information, as an asynchronous operation.
/// Returns a constant, provider and user unique modifier used for entropy in generated tokens from user information.
/// </summary>
/// <param name="purpose">The purpose the token will be generated for.</param>
/// <param name="manager">The <see cref="UserManager{TUser}"/> that can be used to retrieve user properties.</param>

View File

@ -301,7 +301,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Generates a value suitable for use in concurrency tracking, as an asynchronous operation.
/// Generates a value suitable for use in concurrency tracking.
/// </summary>
/// <param name="user">The user to generate the stamp for.</param>
/// <returns>
@ -342,7 +342,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Updates the specified <paramref name="user"/> in the backing store, as an asynchronous operation.
/// Updates the specified <paramref name="user"/> in the backing store.
/// </summary>
/// <param name="user">The user to update.</param>
/// <returns>
@ -361,7 +361,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Deletes the specified <paramref name="user"/> from the backing store, as an asynchronous operation.
/// Deletes the specified <paramref name="user"/> from the backing store.
/// </summary>
/// <param name="user">The user to delete.</param>
/// <returns>
@ -453,7 +453,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Updates the normalized user name for the specified <paramref name="user"/>, as an asynchronous operation.
/// Updates the normalized user name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose user name should be normalized and updated.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation.</returns>
@ -464,7 +464,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the user name for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the user name for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be retrieved.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the name for the specified <paramref name="user"/>.</returns>
@ -479,7 +479,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Sets the given <paramref name="userName" /> for the specified <paramref name="user"/>, as an asynchronous operation.
/// Sets the given <paramref name="userName" /> for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose name should be set.</param>
/// <param name="userName">The user name to set.</param>
@ -498,7 +498,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the user identifier for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the user identifier for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose identifier should be retrieved.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the identifier for the specified <paramref name="user"/>.</returns>
@ -510,7 +510,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Returns a flag indicating whether the given <paramref name="password"/> is valid for the
/// specified <paramref name="user"/>, as an asynchronous operation.
/// specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose password should be validated.</param>
/// <param name="password">The password to validate</param>
@ -542,7 +542,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets a flag indicating whether the specified <paramref name="user"/> has a password, as an asynchronous operation.
/// Gets a flag indicating whether the specified <paramref name="user"/> has a password.
/// </summary>
/// <param name="user">The user to return a flag for, indicating whether they have a password or not.</param>
/// <returns>
@ -563,7 +563,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Adds the <paramref name="password"/> to the specified <paramref name="user"/> only if the user
/// does not already have a password, as an asynchronous operation.
/// does not already have a password.
/// </summary>
/// <param name="user">The user whose password should be set.</param>
/// <param name="password">The password to set.</param>
@ -629,7 +629,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Removes a user's password, as an asynchronous operation.
/// Removes a user's password.
/// </summary>
/// <param name="user">The user whose password should be removed.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -672,7 +672,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Get the security stamp for the specified <paramref name="user" />, as an asynchronous operation.
/// Get the security stamp for the specified <paramref name="user" />.
/// </summary>
/// <param name="user">The user whose security stamp should be set.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the security stamp for the specified <paramref name="user"/>.</returns>
@ -688,7 +688,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Regenerates the security stamp for the specified <paramref name="user" />, as an asynchronous operation.
/// Regenerates the security stamp for the specified <paramref name="user" />.
/// </summary>
/// <param name="user">The user whose security stamp should be regenerated.</param>
/// <returns>
@ -713,7 +713,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Generates a password reset token for the specified <paramref name="user"/>, using
/// the configured password reset token provider, as an asynchronous operation.
/// the configured password reset token provider.
/// </summary>
/// <param name="user">The user to generate a password reset token for.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation,
@ -726,7 +726,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Resets the <paramref name="user"/>'s password to the specified <paramref name="newPassword"/> after
/// validating the given password reset <paramref name="token"/>, as an asynchronous operation.
/// validating the given password reset <paramref name="token"/>.
/// </summary>
/// <param name="user">The user whose password should be reset.</param>
/// <param name="token">The password reset token to verify.</param>
@ -758,7 +758,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Retrieves the user associated with the specified external login provider and login provider key, as an asynchronous operation..
/// Retrieves the user associated with the specified external login provider and login provider key..
/// </summary>
/// <param name="loginProvider">The login provider who provided the <paramref name="providerKey"/>.</param>
/// <param name="providerKey">The key provided by the <paramref name="loginProvider"/> to identify a user.</param>
@ -781,7 +781,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Attempts to remove the provided external login information from the specified <paramref name="user"/>, as an asynchronous operation.
/// Attempts to remove the provided external login information from the specified <paramref name="user"/>.
/// and returns a flag indicating whether the removal succeed or not.
/// </summary>
/// <param name="user">The user to remove the login information from.</param>
@ -814,7 +814,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Adds an external <see cref="UserLoginInfo"/> to the specified <paramref name="user"/>, as an asynchronous operation.
/// Adds an external <see cref="UserLoginInfo"/> to the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to add the login to.</param>
/// <param name="login">The external <see cref="UserLoginInfo"/> to add to the specified <paramref name="user"/>.</param>
@ -846,7 +846,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Retrieves the associated logins for the specified <param ref="user"/>, as an asynchronous operation.
/// Retrieves the associated logins for the specified <param ref="user"/>.
/// </summary>
/// <param name="user">The user whose associated logins to retrieve.</param>
/// <returns>
@ -864,7 +864,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Adds the specified <paramref name="claim"/> to the <paramref name="user"/>, as an asynchronous operation.
/// Adds the specified <paramref name="claim"/> to the <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to add the claim to.</param>
/// <param name="claim">The claim to add.</param>
@ -888,7 +888,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Adds the specified <paramref name="claims"/> to the <paramref name="user"/>, as an asynchronous operation.
/// Adds the specified <paramref name="claims"/> to the <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to add the claim to.</param>
/// <param name="claims">The claims to add.</param>
@ -1014,7 +1014,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Add the specified <paramref name="user"/> to the named role, as an asynchronous operation.
/// Add the specified <paramref name="user"/> to the named role.
/// </summary>
/// <param name="user">The user to add to the named role.</param>
/// <param name="roleName">The name of the role to add the user to.</param>
@ -1040,7 +1040,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Add the specified <paramref name="user"/> to the named roles, as an asynchronous operation.
/// Add the specified <paramref name="user"/> to the named roles.
/// </summary>
/// <param name="user">The user to add to the named roles.</param>
/// <param name="roleName">The name of the roles to add the user to.</param>
@ -1073,7 +1073,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Removes the specified <paramref name="user"/> from the named role, as an asynchronous operation.
/// Removes the specified <paramref name="user"/> from the named role.
/// </summary>
/// <param name="user">The user to remove from the named role.</param>
/// <param name="roleName">The name of the role to remove the user from.</param>
@ -1111,7 +1111,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Removes the specified <paramref name="user"/> from the named roles, as an asynchronous operation.
/// Removes the specified <paramref name="user"/> from the named roles.
/// </summary>
/// <param name="user">The user to remove from the named roles.</param>
/// <param name="roleName">The name of the roles to remove the user from.</param>
@ -1144,7 +1144,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets a list of role names the specified <paramref name="user"/> belongs to, as an asynchronous operation.
/// Gets a list of role names the specified <paramref name="user"/> belongs to.
/// </summary>
/// <param name="user">The user whose role names to retrieve.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing a list of role names.</returns>
@ -1160,7 +1160,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Returns a flag indicating whether the specified <paramref name="user"/> is a member of the give named role, as an asynchronous operation.
/// Returns a flag indicating whether the specified <paramref name="user"/> is a member of the give named role.
/// </summary>
/// <param name="user">The user whose role membership should be checked.</param>
/// <param name="role">The name of the role to be checked.</param>
@ -1180,7 +1180,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the email address for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the email address for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email should be returned.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> used to propagate notifications that the operation should be canceled.</param>
@ -1197,7 +1197,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Sets the <paramref name="email"/> address for a <paramref name="user"/>, as an asynchronous operation.
/// Sets the <paramref name="email"/> address for a <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose email should be set.</param>
/// <param name="email">The email to set.</param>
@ -1255,7 +1255,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Generates an email confirmation token for the specified user, as an asynchronous operation.
/// Generates an email confirmation token for the specified user.
/// </summary>
/// <param name="user">The user to generate an email confirmation token for.</param>
/// <returns>
@ -1268,7 +1268,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Validates that an email confirmation token matches the specified <paramref name="user"/>, as an asynchronous operation.
/// Validates that an email confirmation token matches the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user to validate the token against.</param>
/// <param name="token">The email confirmation token to validate.</param>
@ -1295,7 +1295,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Gets a flag indicating whether the email address for the specified <paramref name="user"/> has been verified, true if the email address is verified otherwise
/// false, as an asynchronous operation.
/// false.
/// </summary>
/// <param name="user">The user whose email confirmation status should be returned.</param>
/// <returns>
@ -1314,7 +1314,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Generates an email change token for the specified user, as an asynchronous operation.
/// Generates an email change token for the specified user.
/// </summary>
/// <param name="user">The user to generate an email change token for.</param>
/// <returns>
@ -1357,7 +1357,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the telephone number, if any, for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets the telephone number, if any, for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose telephone number should be retrieved.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the user's telephone number, if any.</returns>
@ -1428,7 +1428,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets a flag indicating whether the specified <paramref name="user"/>'s telephone number has been confirmed, as an asynchronous operation.
/// Gets a flag indicating whether the specified <paramref name="user"/>'s telephone number has been confirmed.
/// </summary>
/// <param name="user">The user to return a flag for, indicating whether their telephone number is confirmed.</param>
/// <returns>
@ -1447,7 +1447,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Generates a telephone number change token for the specified user, as an asynchronous operation.
/// Generates a telephone number change token for the specified user.
/// </summary>
/// <param name="user">The user to generate a telephone number token for.</param>
/// <param name="phoneNumber">The new phone number the validation token should be sent to.</param>
@ -1464,7 +1464,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Returns a flag indicating whether the specified <paramref name="user"/>'s phone number change verification
/// token is valid for the given <paramref name="phoneNumber"/>, as an asynchronous operation.
/// token is valid for the given <paramref name="phoneNumber"/>.
/// </summary>
/// <param name="user">The user to validate the token against.</param>
/// <param name="token">The telephone number change token to validate.</param>
@ -1492,7 +1492,7 @@ namespace Microsoft.AspNet.Identity
/// <summary>
/// Returns a flag indicating whether the specified <paramref name="token"/> is valid for
/// the given <paramref name="user"/> and <paramref name="purpose"/>, as an asynchronous operation.
/// the given <paramref name="user"/> and <paramref name="purpose"/>.
/// </summary>
/// <param name="user">The user to validate the token against.</param>
/// <param name="tokenProvider">The token provider used to generate the token.</param>
@ -1529,7 +1529,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Generates a token for the given <paramref name="user"/> and <paramref name="purpose"/>, as an asynchronous operation.
/// Generates a token for the given <paramref name="user"/> and <paramref name="purpose"/>.
/// </summary>
/// <param name="purpose">The purpose the token will be for.</param>
/// <param name="user">The user the token will be for.</param>
@ -1600,7 +1600,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Verifies the specified two factor authentication <paramref name="token" /> against the <paramref name="user"/>, as an asynchronous operation.
/// Verifies the specified two factor authentication <paramref name="token" /> against the <paramref name="user"/>.
/// </summary>
/// <param name="user">The user the token is supposed to be for.</param>
/// <param name="tokenProvider">The provider which will verify the token.</param>
@ -1632,7 +1632,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets a two factor authentication token for the specified <paramref name="user"/>, as an asynchronous operation.
/// Gets a two factor authentication token for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user the token is for.</param>
/// <param name="tokenProvider">The provider which will generate the token.</param>
@ -1746,7 +1746,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Retrieves a flag indicating whether user lockout can enabled for the specified user, as an asynchronous operation.
/// Retrieves a flag indicating whether user lockout can enabled for the specified user.
/// </summary>
/// <param name="user">The user whose ability to be locked out should be returned.</param>
/// <returns>
@ -1764,7 +1764,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Gets the last <see cref="DateTimeOffset"/> a user's last lockout expired, if any, as an asynchronous operation.
/// Gets the last <see cref="DateTimeOffset"/> a user's last lockout expired, if any.
/// Any time in the past should be indicates a user is not locked out.
/// </summary>
/// <param name="user">The user whose lockout date should be retrieved.</param>
@ -1783,7 +1783,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Locks out a user until the specified end date has passed, as an asynchronous operation. Setting a end date in the past immediately unlocks a user.
/// Locks out a user until the specified end date has passed. Setting a end date in the past immediately unlocks a user.
/// </summary>
/// <param name="user">The user whose lockout date should be set.</param>
/// <param name="lockoutEnd">The <see cref="DateTimeOffset"/> after which the <paramref name="user"/>'s lockout should end.</param>
@ -1836,7 +1836,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Resets the access failed count for the specified <paramref name="user"/>, as an asynchronous operation.
/// Resets the access failed count for the specified <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose failed access count should be reset.</param>
/// <returns>The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/> of the operation.</returns>
@ -1858,7 +1858,7 @@ namespace Microsoft.AspNet.Identity
}
/// <summary>
/// Retrieves the current number of failed accesses for the given <paramref name="user"/>, as an asynchronous operation.
/// Retrieves the current number of failed accesses for the given <paramref name="user"/>.
/// </summary>
/// <param name="user">The user whose access failed count should be retrieved for.</param>
/// <returns>The <see cref="Task"/> that contains the result the asynchronous operation, the current failed access count

View File

@ -1,6 +1,10 @@
{
"description": "Core implementation for ASP.NET Identity.",
"version": "3.0.0-*",
"compilationOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"repository": {
"type": "git",
"url": "git://github.com/aspnet/identity"

View File

@ -1,4 +1,8 @@
{
"compilationOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"dependencies": {
"Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
@ -7,14 +11,14 @@
"Microsoft.AspNet.DataProtection": "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
"EntityFramework.InMemory": "7.0.0-*",
"Microsoft.Extensions.OptionsModel" : "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"compile": "..\\Shared\\*.cs",
"frameworks": {
"dnx451": {
"dependencies": {
"Moq" : "4.2.1312.1622"
"Moq": "4.2.1312.1622"
}
}
},

View File

@ -1,4 +1,8 @@
{
"compilationOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"dependencies": {
"EntityFramework.InMemory": "7.0.0-*",
"EntityFramework.MicrosoftSqlServer": "7.0.0-*",
@ -9,14 +13,14 @@
"Microsoft.AspNet.DataProtection": "1.0.0-*",
"Microsoft.AspNet.TestHost": "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
"Microsoft.Extensions.OptionsModel" : "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"compile": "..\\Shared\\*.cs",
"frameworks": {
"dnx451": {
"dependencies": {
"Moq" : "4.2.1312.1622"
"Moq": "4.2.1312.1622"
}
}
},

View File

@ -1,15 +1,19 @@
{
"compilationOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"dependencies": {
"Microsoft.AspNet.Authentication" : "1.0.0-*",
"Microsoft.AspNet.Authentication.Cookies" : "1.0.0-*",
"Microsoft.AspNet.Authentication": "1.0.0-*",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-*",
"Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.AspNet.Http" : "1.0.0-*",
"Microsoft.AspNet.Identity" : "3.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Identity": "3.0.0-*",
"Microsoft.AspNet.TestHost": "1.0.0-*",
"Microsoft.AspNet.Testing" : "1.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
"Microsoft.Extensions.Configuration": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection" : "1.0.0-*",
"Microsoft.Extensions.OptionsModel" : "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*",
"Moq": "4.2.1312.1622",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},

View File

@ -1,19 +1,23 @@
{
"compilationOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk"
},
"dependencies": {
"Microsoft.AspNet.Hosting" : "1.0.0-*",
"Microsoft.AspNet.Http" : "1.0.0-*",
"Microsoft.AspNet.Identity" : "3.0.0-*",
"Microsoft.AspNet.Testing" : "1.0.0-*",
"Microsoft.Extensions.Configuration" : "1.0.0-*",
"Microsoft.Extensions.DependencyInjection" : "1.0.0-*",
"Microsoft.Extensions.OptionsModel" : "1.0.0-*",
"Microsoft.AspNet.Hosting": "1.0.0-*",
"Microsoft.AspNet.Http": "1.0.0-*",
"Microsoft.AspNet.Identity": "3.0.0-*",
"Microsoft.AspNet.Testing": "1.0.0-*",
"Microsoft.Extensions.Configuration": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0-*",
"Microsoft.Extensions.OptionsModel": "1.0.0-*",
"xunit.runner.aspnet": "2.0.0-aspnet-*"
},
"compile": "..\\Shared\\*.cs",
"frameworks": {
"dnx451": {
"dependencies": {
"Moq" : "4.2.1312.1622"
"Moq": "4.2.1312.1622"
}
}
},

BIN
tools/Key.snk Normal file

Binary file not shown.