public void AddMapping(AuthenticationOptionMapping mapping)
        {
            var hit = from m in Mappings
                      where m.Options.RequestType == mapping.Options.RequestType &&
                      m.Options.Name == mapping.Options.Name &&
                      m.Options.Scheme.Equals(mapping.Options.Scheme, StringComparison.OrdinalIgnoreCase)
                      select m;

            if (hit.FirstOrDefault() != null)
            {
                throw new InvalidOperationException("Duplicate authentication entry");
            }

            Mappings.Add(mapping);

            switch (mapping.Options.RequestType)
            {
            case HttpRequestType.AuthorizationHeader:
                _hasAuthorizationHeader = true;
                break;

            case HttpRequestType.Header:
                _hasHeader = true;
                break;

            case HttpRequestType.QueryString:
                _hasQueryString = true;
                break;

            case HttpRequestType.Cookie:
                _hasCookie = true;
                break;

            case HttpRequestType.ClientCertificate:
                _hasClientCert = true;
                break;

            default:
                throw new InvalidOperationException("Invalid request type");
            }
        }
        public void AddMapping(AuthenticationOptionMapping mapping)
        {
            var hit = from m in Mappings
                      where m.Options.RequestType == mapping.Options.RequestType &&
                            m.Options.Name == mapping.Options.Name &&
                            m.Options.Scheme.Equals(mapping.Options.Scheme, StringComparison.OrdinalIgnoreCase)
                      select m;

            if (hit.FirstOrDefault() != null)
            {
                throw new InvalidOperationException("Duplicate authentication entry");
            }

            Mappings.Add(mapping);

            switch (mapping.Options.RequestType)
            {
                case HttpRequestType.AuthorizationHeader:
                    _hasAuthorizationHeader = true;
                    break;
                case HttpRequestType.Header:
                    _hasHeader = true;
                    break;
                case HttpRequestType.QueryString:
                    _hasQueryString = true;
                    break;
                case HttpRequestType.Cookie:
                    _hasCookie = true;
                    break;
                case HttpRequestType.ClientCertificate:
                    _hasClientCert = true;
                    break;
                default:
                    throw new InvalidOperationException("Invalid request type");
            }
        }