예제 #1
0
        public static bool VerifyPassword(this User @this, string clearTextPassword)
        {
            if (string.IsNullOrWhiteSpace(clearTextPassword))
            {
                return(false);
            }

            var securityService = @this.Session().ServiceProvider.GetRequiredService <IPasswordService>();

            return(securityService.VerifyHashedPassword(@this.UserName, @this.UserPasswordHash, clearTextPassword));
        }
예제 #2
0
        public static void CoreOnDerive(this User @this, ObjectOnDerive method)
        {
            @this.DerivedRoles.NormalizedUserName  = Users.Normalize(@this.UserName);
            @this.DerivedRoles.NormalizedUserEmail = Users.Normalize(@this.UserEmail);

            if (@this.ExistInUserPassword)
            {
                var passwordService = @this.Session().ServiceProvider.GetRequiredService <IPasswordService>();
                @this.UserPasswordHash = passwordService.HashPassword(@this.UserName, @this.InUserPassword);
                @this.RemoveInUserPassword();
            }
        }
예제 #3
0
        public static bool IsAdministrator(this User @this)
        {
            var administrators = new UserGroups(@this.Session()).Administrators;

            return(administrators.Members.Contains(@this));
        }