M$ AspNet.WebApi 2.2
Testé avec mono current sous Debian Sid: l'import AspNet.WebApi 2.2
This commit is contained in:
parent
d40679cdf4
commit
1f64b48966
97 changed files with 7890 additions and 9323 deletions
84
web/Models/Identity/AccountBindingModels.cs
Normal file
84
web/Models/Identity/AccountBindingModels.cs
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Yavsc.Models.Identity
|
||||
{
|
||||
// Models used as parameters to AccountController actions.
|
||||
|
||||
public class AddExternalLoginBindingModel
|
||||
{
|
||||
[Required]
|
||||
[Display(Name = "External access token")]
|
||||
public string ExternalAccessToken { get; set; }
|
||||
}
|
||||
|
||||
public class ChangePasswordBindingModel
|
||||
{
|
||||
[Required]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Current password")]
|
||||
public string OldPassword { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "New password")]
|
||||
public string NewPassword { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm new password")]
|
||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
|
||||
public class RegisterBindingModel
|
||||
{
|
||||
[Required]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm password")]
|
||||
[Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
|
||||
public class RegisterExternalBindingModel
|
||||
{
|
||||
[Required]
|
||||
[Display(Name = "Email")]
|
||||
public string Email { get; set; }
|
||||
}
|
||||
|
||||
public class RemoveLoginBindingModel
|
||||
{
|
||||
[Required]
|
||||
[Display(Name = "Login provider")]
|
||||
public string LoginProvider { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Provider key")]
|
||||
public string ProviderKey { get; set; }
|
||||
}
|
||||
|
||||
public class SetPasswordBindingModel
|
||||
{
|
||||
[Required]
|
||||
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "New password")]
|
||||
public string NewPassword { get; set; }
|
||||
|
||||
[DataType(DataType.Password)]
|
||||
[Display(Name = "Confirm new password")]
|
||||
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
|
||||
public string ConfirmPassword { get; set; }
|
||||
}
|
||||
}
|
||||
43
web/Models/Identity/AccountViewModels.cs
Normal file
43
web/Models/Identity/AccountViewModels.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.Models.Identity
|
||||
{
|
||||
// Models returned by AccountController actions.
|
||||
|
||||
public class ExternalLoginViewModel
|
||||
{
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Url { get; set; }
|
||||
|
||||
public string State { get; set; }
|
||||
}
|
||||
|
||||
public class ManageInfoViewModel
|
||||
{
|
||||
public string LocalLoginProvider { get; set; }
|
||||
|
||||
public string Email { get; set; }
|
||||
|
||||
public IEnumerable<UserLoginInfoViewModel> Logins { get; set; }
|
||||
|
||||
public IEnumerable<ExternalLoginViewModel> ExternalLoginProviders { get; set; }
|
||||
}
|
||||
|
||||
public class UserInfoViewModel
|
||||
{
|
||||
public string Email { get; set; }
|
||||
|
||||
public bool HasRegistered { get; set; }
|
||||
|
||||
public string LoginProvider { get; set; }
|
||||
}
|
||||
|
||||
public class UserLoginInfoViewModel
|
||||
{
|
||||
public string LoginProvider { get; set; }
|
||||
|
||||
public string ProviderKey { get; set; }
|
||||
}
|
||||
}
|
||||
33
web/Models/Identity/IdentityModels.cs
Normal file
33
web/Models/Identity/IdentityModels.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Identity;
|
||||
using Microsoft.AspNet.Identity.EntityFramework;
|
||||
using Microsoft.AspNet.Identity.Owin;
|
||||
|
||||
namespace Yavsc.Models.Identity
|
||||
{
|
||||
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
|
||||
public class ApplicationUser : IdentityUser
|
||||
{
|
||||
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager, string authenticationType)
|
||||
{
|
||||
// Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
|
||||
var userIdentity = await manager.CreateIdentityAsync(this, authenticationType);
|
||||
// Add custom user claims here
|
||||
return userIdentity;
|
||||
}
|
||||
}
|
||||
|
||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
||||
{
|
||||
public ApplicationDbContext()
|
||||
: base("DefaultConnection", throwIfV1Schema: false)
|
||||
{
|
||||
}
|
||||
|
||||
public static ApplicationDbContext Create()
|
||||
{
|
||||
return new ApplicationDbContext();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue