Skip to content
This repository has been archived by the owner on Dec 20, 2018. It is now read-only.

Commit

Permalink
Add missing doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoK committed Jul 11, 2016
1 parent f73f668 commit ec4c08d
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

namespace Microsoft.Extensions.DependencyInjection
{
/// <summary>
/// Contains extension methods to <see cref="IdentityBuilder"/> for adding entity framework stores.
/// </summary>
public static class IdentityEntityFrameworkBuilderExtensions
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ public class IdentityRoleClaim<TKey> where TKey : IEquatable<TKey>
/// </summary>
public virtual string ClaimValue { get; set; }

/// <summary>
/// Constructs a new claim with the type and value.
/// </summary>
/// <returns></returns>
public virtual Claim ToClaim()
{
return new Claim(ClaimType, ClaimValue);
}

/// <summary>
/// Initializes by copying ClaimType and ClaimValue from the other claim.
/// </summary>
/// <param name="other">The claim to initialize from.</param>
public virtual void InitializeFromClaim(Claim other)
{
ClaimType = other?.Type;
Expand Down
39 changes: 33 additions & 6 deletions src/Microsoft.AspNetCore.Identity.EntityFrameworkCore/RoleStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore
public class RoleStore<TRole> : RoleStore<TRole, DbContext, string>
where TRole : IdentityRole<string>
{
/// <summary>
/// Constructs a new instance of <see cref="RoleStore{TRole}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public RoleStore(DbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}

Expand All @@ -31,6 +36,11 @@ public class RoleStore<TRole, TContext> : RoleStore<TRole, TContext, string>
where TRole : IdentityRole<string>
where TContext : DbContext
{
/// <summary>
/// Constructs a new instance of <see cref="RoleStore{TRole, TContext}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public RoleStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}

Expand All @@ -47,10 +57,19 @@ public class RoleStore<TRole, TContext, TKey> : RoleStore<TRole, TContext, TKey,
where TKey : IEquatable<TKey>
where TContext : DbContext
{
public RoleStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer)
{
}
/// <summary>
/// Constructs a new instance of <see cref="RoleStore{TRole, TContext, TKey}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public RoleStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }

/// <summary>
/// Creates a entity representing a role claim.
/// </summary>
/// <param name="role">The associated role.</param>
/// <param name="claim">The associated claim.</param>
/// <returns>The role claim entity.</returns>
protected override IdentityRoleClaim<TKey> CreateRoleClaim(TRole role, Claim claim)
{
return new IdentityRoleClaim<TKey> { RoleId = role.Id, ClaimType = claim.Type, ClaimValue = claim.Value };
Expand All @@ -74,6 +93,11 @@ public abstract class RoleStore<TRole, TContext, TKey, TUserRole, TRoleClaim> :
where TUserRole : IdentityUserRole<TKey>
where TRoleClaim : IdentityRoleClaim<TKey>
{
/// <summary>
/// Constructs a new instance of <see cref="RoleStore{TRole, TContext, TKey, TUserRole, TRoleClaim}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public RoleStore(TContext context, IdentityErrorDescriber describer = null)
{
if (context == null)
Expand Down Expand Up @@ -333,6 +357,9 @@ public virtual string ConvertIdToString(TKey id)
return Task.FromResult(0);
}

/// <summary>
/// Throws if this class has been disposed.
/// </summary>
protected void ThrowIfDisposed()
{
if (_disposed)
Expand Down Expand Up @@ -427,9 +454,9 @@ public virtual IQueryable<TRole> Roles
/// <summary>
/// Creates a entity representing a role claim.
/// </summary>
/// <param name="role"></param>
/// <param name="claim"></param>
/// <returns></returns>
/// <param name="role">The associated role.</param>
/// <param name="claim">The associated claim.</param>
/// <returns>The role claim entity.</returns>
protected abstract TRoleClaim CreateRoleClaim(TRole role, Claim claim);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ namespace Microsoft.AspNetCore.Identity.EntityFrameworkCore
/// </summary>
public class UserStore : UserStore<IdentityUser<string>>
{
/// <summary>
/// Constructs a new instance of <see cref="UserStore"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public UserStore(DbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}

Expand All @@ -29,6 +34,11 @@ public UserStore(DbContext context, IdentityErrorDescriber describer = null) : b
public class UserStore<TUser> : UserStore<TUser, IdentityRole, DbContext, string>
where TUser : IdentityUser<string>, new()
{
/// <summary>
/// Constructs a new instance of <see cref="UserStore{TUser}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public UserStore(DbContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }
}

Expand All @@ -43,8 +53,14 @@ public class UserStore<TUser, TRole, TContext> : UserStore<TUser, TRole, TContex
where TRole : IdentityRole<string>
where TContext : DbContext
{
/// <summary>
/// Constructs a new instance of <see cref="UserStore{TUser, TRole, TContext}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
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>
Expand All @@ -58,8 +74,19 @@ public class UserStore<TUser, TRole, TContext, TKey> : UserStore<TUser, TRole, T
where TContext : DbContext
where TKey : IEquatable<TKey>
{
/// <summary>
/// Constructs a new instance of <see cref="UserStore{TUser, TRole, TContext, TKey}"/>.
/// </summary>
/// <param name="context">The <see cref="DbContext"/>.</param>
/// <param name="describer">The <see cref="IdentityErrorDescriber"/>.</param>
public UserStore(TContext context, IdentityErrorDescriber describer = null) : base(context, describer) { }

/// <summary>
/// Called to create a new instance of a <see cref="IdentityUserRole{TKey}"/>.
/// </summary>
/// <param name="user">The associated user.</param>
/// <param name="role">The associated role.</param>
/// <returns></returns>
protected override IdentityUserRole<TKey> CreateUserRole(TUser user, TRole role)
{
return new IdentityUserRole<TKey>()
Expand All @@ -69,13 +96,25 @@ protected override IdentityUserRole<TKey> CreateUserRole(TUser user, TRole role)
};
}

/// <summary>
/// Called to create a new instance of a <see cref="IdentityUserClaim{TKey}"/>.
/// </summary>
/// <param name="user">The associated user.</param>
/// <param name="claim">The associated claim.</param>
/// <returns></returns>
protected override IdentityUserClaim<TKey> CreateUserClaim(TUser user, Claim claim)
{
var userClaim = new IdentityUserClaim<TKey> { UserId = user.Id };
userClaim.InitializeFromClaim(claim);
return userClaim;
}

/// <summary>
/// Called to create a new instance of a <see cref="IdentityUserLogin{TKey}"/>.
/// </summary>
/// <param name="user">The associated user.</param>
/// <param name="login">The sasociated login.</param>
/// <returns></returns>
protected override IdentityUserLogin<TKey> CreateUserLogin(TUser user, UserLoginInfo login)
{
return new IdentityUserLogin<TKey>
Expand All @@ -87,6 +126,14 @@ protected override IdentityUserLogin<TKey> CreateUserLogin(TUser user, UserLogin
};
}

/// <summary>
/// Called to create a new instance of a <see cref="IdentityUserToken{TKey}"/>.
/// </summary>
/// <param name="user">The associated user.</param>
/// <param name="loginProvider">The associated login provider.</param>
/// <param name="name">The name of the user token.</param>
/// <param name="value">The value of the user token.</param>
/// <returns></returns>
protected override IdentityUserToken<TKey> CreateUserToken(TUser user, string loginProvider, string name, string value)
{
return new IdentityUserToken<TKey>
Expand Down Expand Up @@ -603,6 +650,9 @@ where userRole.UserId.Equals(userId)
return false;
}

/// <summary>
/// Throws if this class has been disposed.
/// </summary>
protected void ThrowIfDisposed()
{
if (_disposed)
Expand Down Expand Up @@ -1289,7 +1339,15 @@ private Task<TUserToken> FindToken(TUser user, string loginProvider, string name
return UserTokens.SingleOrDefaultAsync(l => l.UserId.Equals(userId) && l.LoginProvider == loginProvider && l.Name == name, cancellationToken);
}

// <inheritdoc>
/// <summary>
/// Sets the token value for a particular user.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="loginProvider">The authentication provider for the token.</param>
/// <param name="name">The name of the token.</param>
/// <param name="value">The value of the token.</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 SetTokenAsync(TUser user, string loginProvider, string name, string value, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Expand All @@ -1311,6 +1369,14 @@ public virtual async Task SetTokenAsync(TUser user, string loginProvider, string
}
}

/// <summary>
/// Deletes a token for a user.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="loginProvider">The authentication provider for the token.</param>
/// <param name="name">The name of the token.</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 RemoveTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Expand All @@ -1328,6 +1394,14 @@ public async Task RemoveTokenAsync(TUser user, string loginProvider, string name
}
}

/// <summary>
/// Returns the token value.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="loginProvider">The authentication provider for the token.</param>
/// <param name="name">The name of the token.</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<string> GetTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
"buildOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk",
"nowarn": [
"CS1591"
],
"xmlDoc": true
},
"packOptions": {
Expand Down
3 changes: 3 additions & 0 deletions src/Microsoft.AspNetCore.Identity/ExternalLoginInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public ExternalLoginInfo(ClaimsPrincipal principal, string loginProvider, string
/// <value>The <see cref="ClaimsPrincipal"/> associated with this login.</value>
public ClaimsPrincipal Principal { get; set; }

/// <summary>
/// The <see cref="AuthenticationToken"/>s associated with this login.
/// </summary>
public IEnumerable<AuthenticationToken> AuthenticationTokens { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public interface IUserAuthenticationTokenStore<TUser> : IUserStore<TUser> where
/// <param name="loginProvider">The authentication provider for the token.</param>
/// <param name="name">The name of the token.</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>
Task RemoveTokenAsync(TUser user, string loginProvider, string name, CancellationToken cancellationToken);

/// <summary>
Expand Down
18 changes: 18 additions & 0 deletions src/Microsoft.AspNetCore.Identity/IdentityCookieOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class IdentityCookieOptions
private static readonly string DefaultTwoFactorRememberMeScheme = CookiePrefix + ".TwoFactorRememberMe";
private static readonly string DefaultTwoFactorUserIdScheme = CookiePrefix + ".TwoFactorUserId";

/// <summary>
/// Constructs a new instance of <see cref="IdentityCookieOptions"/>.
/// </summary>
public IdentityCookieOptions()
{
// Configure all of the cookie middlewares
Expand Down Expand Up @@ -58,9 +61,24 @@ public IdentityCookieOptions()
};
}

/// <summary>
/// The options for the application cookie.
/// </summary>
public CookieAuthenticationOptions ApplicationCookie { get; set; }

/// <summary>
/// The options for the external cookie.
/// </summary>
public CookieAuthenticationOptions ExternalCookie { get; set; }

/// <summary>
/// The options for the two factor remember me cookie.
/// </summary>
public CookieAuthenticationOptions TwoFactorRememberMeCookie { get; set; }

/// <summary>
/// The options for the two factor user id cookie.
/// </summary>
public CookieAuthenticationOptions TwoFactorUserIdCookie { get; set; }

/// <summary>
Expand Down
5 changes: 4 additions & 1 deletion src/Microsoft.AspNetCore.Identity/RoleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,10 @@ private IRoleClaimStore<TRole> GetClaimStore()
}
return cast;
}


/// <summary>
/// Throws if this class has been disposed.
/// </summary>
protected void ThrowIfDisposed()
{
if (_disposed)
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.AspNetCore.Identity/SecurityStampValidator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ public class SecurityStampValidator<TUser> : ISecurityStampValidator where TUser
private readonly SignInManager<TUser> _signInManager;
private readonly IdentityOptions _options;

/// <summary>
/// Creates a new instance of <see cref="SecurityStampValidator{TUser}"/>.
/// </summary>
/// <param name="options">Used to access the <see cref="IdentityOptions"/>.</param>
/// <param name="signInManager">The <see cref="SignInManager{TUser}"/>.</param>
public SecurityStampValidator(IOptions<IdentityOptions> options, SignInManager<TUser> signInManager)
{
if (options == null)
Expand Down
5 changes: 5 additions & 0 deletions src/Microsoft.AspNetCore.Identity/SignInManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,12 @@ public SignInManager(UserManager<TUser> userManager,
/// The <see cref="ILogger"/> used to log messages from the manager.
/// </value>
protected internal virtual ILogger Logger { get; set; }

/// <summary>
/// The <see cref="UserManager{TUser}"/> used.
/// </summary>
protected internal UserManager<TUser> UserManager { get; set; }

internal IUserClaimsPrincipalFactory<TUser> ClaimsFactory { get; set; }
internal IdentityOptions Options { get; set; }

Expand Down
14 changes: 14 additions & 0 deletions src/Microsoft.AspNetCore.Identity/TokenOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,24 @@

namespace Microsoft.AspNetCore.Identity
{
/// <summary>
/// Options for user tokens.
/// </summary>
public class TokenOptions
{
/// <summary>
/// Default token provider name used by email confirmation, password reset, and change email.
/// </summary>
public static readonly string DefaultProvider = "Default";

/// <summary>
/// Default token provider name used by the <see cref="EmailTokenProvider{TUser}"/>.
/// </summary>
public static readonly string DefaultEmailProvider = "Email";

/// <summary>
/// Default token provider name used by the <see cref="PhoneNumberTokenProvider{TUser}"/>.
/// </summary>
public static readonly string DefaultPhoneProvider = "Phone";

/// <summary>
Expand Down
Loading

0 comments on commit ec4c08d

Please sign in to comment.