Esempio n. 1
0
        /// <summary>
        /// CheckRequest returns true if b contains a valid username and password.
        /// </summary>
        /// <param name="b"></param>
        /// <returns></returns>
        public bool CheckRequest(IBasicAuther b)
        {
            var auth = b.BasicAuth();

            return(auth.ok && Check(auth.username, auth.password));
        }
Esempio n. 2
0
        /// <summary>
        /// HasPermRequest returns true if the username returned by b has the givem perm.
        /// It does not perform any password checking, but if there is no username in the request, it returns false.
        /// </summary>
        /// <param name="basic"></param>
        /// <param name="perm"></param>
        /// <returns></returns>
        public bool HasPermRequest(IBasicAuther b, string perm)
        {
            var auth = b.BasicAuth();

            return(auth.ok && HasPerm(auth.username, perm));
        }