// Path: cors-policy/src/main/java/io/apiman/plugins/cors_policy/util/InsensitiveLinkedHashSet.java
// public class InsensitiveLinkedHashSet extends LinkedHashSet<String> implements Serializable, Set<String> {
// 
//     private static final long serialVersionUID = -3273143085866100001L;
//     private Set<String> innerSet = new HashSet<>();
// 
//     public InsensitiveLinkedHashSet() {
//         super();
//     }
// 
//     public InsensitiveLinkedHashSet(Collection<? extends String> entries) {
//         super(entries.size());
//         addAll(entries);
//     }
// 
//     @Override
//     public boolean add(String entry) {
//         if (entry == null || innerSet.contains(entry.toLowerCase())) {
//             return false;
//         }
// 
//         innerSet.add(entry.toLowerCase());
//         return super.add(entry);
//     }
// 
//     @Override
//     public boolean addAll(Collection<? extends String> entries) {
//         boolean success = true;
// 
//         for (String entry : entries) {
//             success = success && add(entry);
//         }
// 
//         return success;
//     }
// 
//     @Override
//     public boolean containsAll(Collection<?> entries) {
//         boolean success = true;
// 
//         for (Object entry : entries) {
//             if (entry instanceof String) {
//                 success = success && contains(entry);
//             }
//         }
// 
//         return success;
//     }
// 
//     @Override
//     public boolean contains(Object candidate) {
//         if (candidate == null || !(candidate instanceof String))
//             return false;
// 
//         return innerSet.contains(((String) candidate).toLowerCase());
//     }
// 
// }


import io.apiman.plugins.cors_policy.util.HttpHelper;
import io.apiman.plugins.cors_policy.util.InsensitiveLinkedHashSet;
import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/*
 * Copyright 2015 JBoss Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.apiman.plugins.cors_policy;





/**
 * CORS Policy Configuration
 *
 * @author Marc Savy {@literal <msavy@redhat.com>}
 */
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({ "errorOnCorsFailure", "allowOrigin", "allowCredentials", "exposeHeaders",
        "allowHeaders", "allowMethods", "maxAge" })
public class CorsConfigBean implements Serializable {
    private static final long serialVersionUID = 6655123241544127400L;

    /**
     * Terminate on CORS error
     * <p>
     * When true, any request that fails CORS validation will be terminated with an appropriate error. When
     * false, the request will still be sent to the backend API, but the browser will be left to enforce
     * the CORS failure. In both cases valid CORS headers will be set.
     *
     */
    @JsonProperty("errorOnCorsFailure")
    private boolean errorOnCorsFailure = true;
    /**
     * Access-Control-Allow-Origin
     * <p>
     * List of origins permitted to make CORS requests through the gateway. By default same-origin is
     * permitted, and cross-origin is forbidden. An entry of * permits all CORS requests.
     *
     */
    @JsonProperty("allowOrigin")
// Path: cors-policy/src/main/java/io/apiman/plugins/cors_policy/util/InsensitiveLinkedHashSet.java
// public class InsensitiveLinkedHashSet extends LinkedHashSet<String> implements Serializable, Set<String> {
// 
//     private static final long serialVersionUID = -3273143085866100001L;
//     private Set<String> innerSet = new HashSet<>();
// 
//     public InsensitiveLinkedHashSet() {
//         super();
//     }
// 
//     public InsensitiveLinkedHashSet(Collection<? extends String> entries) {
//         super(entries.size());
//         addAll(entries);
//     }
// 
//     @Override
//     public boolean add(String entry) {
//         if (entry == null || innerSet.contains(entry.toLowerCase())) {
//             return false;
//         }
// 
//         innerSet.add(entry.toLowerCase());
//         return super.add(entry);
//     }
// 
//     @Override
//     public boolean addAll(Collection<? extends String> entries) {
//         boolean success = true;
// 
//         for (String entry : entries) {
//             success = success && add(entry);
//         }
// 
//         return success;
//     }
// 
//     @Override
//     public boolean containsAll(Collection<?> entries) {
//         boolean success = true;
// 
//         for (Object entry : entries) {
//             if (entry instanceof String) {
//                 success = success && contains(entry);
//             }
//         }
// 
//         return success;
//     }
// 
//     @Override
//     public boolean contains(Object candidate) {
//         if (candidate == null || !(candidate instanceof String))
//             return false;
// 
//         return innerSet.contains(((String) candidate).toLowerCase());
//     }
// 
// }


// Path: cors-policy/src/main/java/io/apiman/plugins/cors_policy/CorsConfigBean.java
import io.apiman.plugins.cors_policy.util.HttpHelper;
import io.apiman.plugins.cors_policy.util.InsensitiveLinkedHashSet;
import java.io.Serializable;
import java.util.LinkedHashSet;
import java.util.Set;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/*
 * Copyright 2015 JBoss Inc
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.apiman.plugins.cors_policy;





/**
 * CORS Policy Configuration
 *
 * @author Marc Savy {@literal <msavy@redhat.com>}
 */
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
@Generated("org.jsonschema2pojo")
@JsonPropertyOrder({ "errorOnCorsFailure", "allowOrigin", "allowCredentials", "exposeHeaders",
        "allowHeaders", "allowMethods", "maxAge" })
public class CorsConfigBean implements Serializable {
    private static final long serialVersionUID = 6655123241544127400L;

    /**
     * Terminate on CORS error
     * <p>
     * When true, any request that fails CORS validation will be terminated with an appropriate error. When
     * false, the request will still be sent to the backend API, but the browser will be left to enforce
     * the CORS failure. In both cases valid CORS headers will be set.
     *
     */
    @JsonProperty("errorOnCorsFailure")
    private boolean errorOnCorsFailure = true;
    /**
     * Access-Control-Allow-Origin
     * <p>
     * List of origins permitted to make CORS requests through the gateway. By default same-origin is
     * permitted, and cross-origin is forbidden. An entry of * permits all CORS requests.
     *
     */
    @JsonProperty("allowOrigin")
    @JsonDeserialize(as = InsensitiveLinkedHashSet.class)