AIMS_BD_IATI.WebAPI.Modules.BasicAuthHttpModule.AuthenticateUser C# (CSharp) Method

AuthenticateUser() private static method

private static AuthenticateUser ( string credentials ) : bool
credentials string
return bool
        private static bool AuthenticateUser(string credentials)
        {
            var encoding = Encoding.GetEncoding("iso-8859-1");
            credentials = encoding.GetString(Convert.FromBase64String(credentials));

            var credentialsArray = credentials.Split(':');
            var username = credentialsArray[0];
            var password = credentialsArray[1];

            //Check Security Service
            AIMS_BD_IATI.WebAPI.Models.Authentication.AccountMembershipService MembershipService = new AIMS_BD_IATI.WebAPI.Models.Authentication.AccountMembershipService();
            if (!MembershipService.ValidateUser(username, password))
            {
                return false;
            }

            var identity = new GenericIdentity(username);
            SetPrincipal(new GenericPrincipal(identity, null));

            return true;
        }