导航

12-001 Identity 之 IdentityOptions

Posted on 2015-04-23 17:38  DotNet1010  阅读(270)  评论(0)    收藏  举报

--

  /// <summary>
    ///     Configuration for identity
    /// </summary>
    public class IdentityOptions
    {

        /*
         public string RoleClaimType     { get; set; } = ClaimTypes.Role;
         public string UserNameClaimType { get; set; } = ClaimTypes.Name;
         public string UserIdClaimType   { get; set; } = ClaimTypes.NameIdentifier;
         public string SecurityStampClaimType { get; set; } = "AspNet.Identity.SecurityStamp";
        */
        public ClaimsIdentityOptions ClaimsIdentity { get; set; } = new ClaimsIdentityOptions();

        /*
          public string UserNameValidationRegex { get; set; } = "^[a-zA-Z0-9@_\\.]+$";
          public bool RequireUniqueEmail { get; set; }
        */
        public UserOptions User { get; set; } = new UserOptions();

        /*
        public int  RequiredLength { get; set; } = 6;
        public bool RequireNonLetterOrDigit { get; set; } = true;
        public bool RequireLowercase { get; set; } = true;
        public bool RequireUppercase { get; set; } = true;
        public bool RequireDigit { get; set; } = true;
        */
        public PasswordOptions Password { get; set; } = new PasswordOptions();
        /*
        public bool EnabledByDefault { get; set; } = false;
        public int MaxFailedAccessAttempts { get; set; } = 5;
        public TimeSpan DefaultLockoutTimeSpan { get; set; } = TimeSpan.FromMinutes(5);
        */
        public LockoutOptions Lockout { get; set; } = new LockoutOptions();
        /*
        public bool RequireConfirmedEmail { get; set; }
        public bool RequireConfirmedPhoneNumber { get; set; }
        */
        public SignInOptions SignIn { get; set; } = new SignInOptions();
        /*

        */
        public TimeSpan SecurityStampValidationInterval { get; set; } = TimeSpan.FromMinutes(30);

        public string EmailConfirmationTokenProvider { get; set; } = Resources.DefaultTokenProvider;

        public string PasswordResetTokenProvider { get; set; } = Resources.DefaultTokenProvider;

        public string ChangeEmailTokenProvider { get; set; } = Resources.DefaultTokenProvider;

        public static string ApplicationCookieAuthenticationType { get; set; } = typeof(IdentityOptions).Namespace + ".Application";
        public static string ExternalCookieAuthenticationType { get; set; } = typeof(IdentityOptions).Namespace + ".External";
        public static string TwoFactorUserIdCookieAuthenticationType { get; set; } = typeof(IdentityOptions).Namespace + ".TwoFactorUserId";
        public static string TwoFactorRememberMeCookieAuthenticationType { get; set; } = typeof(IdentityOptions).Namespace + ".TwoFactorRemeberMe";
    }