public WebAuthenticationConfigurationAttribute(
            Type authenticationHandler,
            Type usernamePasswordValidator,
            bool requireSecureTransport,
            string source)
        {
            if (authenticationHandler != null && !authenticationHandler.CastableAs<IWebAuthenticationHandler>())
                throw new Exception(string.Format("authenticationHandler {0} must implement IWebAuthenticationHandler.", authenticationHandler.Name));

            if (usernamePasswordValidator != null && !usernamePasswordValidator.CastableAs<UserNamePasswordValidator>())
                throw new Exception(string.Format("usernamePasswordValidator {0} must inherit from UserNamePasswordValidator.", usernamePasswordValidator.Name));

             _behavior = new WebAuthenticationConfigurationBehavior(
                authenticationHandler,
                usernamePasswordValidator,
                requireSecureTransport,
                source);
        }
コード例 #2
0
        public WebAuthenticationConfigurationAttribute(
            Type authenticationHandler,
            Type usernamePasswordValidator,
            bool requireSecureTransport,
            string source)
        {
            if (authenticationHandler != null && !authenticationHandler.CastableAs <IWebAuthenticationHandler>())
            {
                throw new Exception(string.Format("authenticationHandler {0} must implement IWebAuthenticationHandler.", authenticationHandler.Name));
            }

            if (usernamePasswordValidator != null && !usernamePasswordValidator.CastableAs <UserNamePasswordValidator>())
            {
                throw new Exception(string.Format("usernamePasswordValidator {0} must inherit from UserNamePasswordValidator.", usernamePasswordValidator.Name));
            }

            _behavior = new WebAuthenticationConfigurationBehavior(
                authenticationHandler,
                usernamePasswordValidator,
                requireSecureTransport,
                source);
        }