// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.restapi.filter;

import com.google.common.collect.ImmutableMap;

import java.util.Map;

import static java.util.concurrent.TimeUnit.DAYS;

/**
 * @author gv
 */
public interface AccessControlHeaders {

    String CORS_PREFLIGHT_REQUEST_CACHE_TTL =  Long.toString(DAYS.toSeconds(7));

    String ALLOW_ORIGIN_HEADER = "Access-Control-Allow-Origin";

    Map<String, String> ACCESS_CONTROL_HEADERS = ImmutableMap.of(
            "Access-Control-Max-Age", CORS_PREFLIGHT_REQUEST_CACHE_TTL,
            "Access-Control-Allow-Headers", "Origin,Content-Type,Accept,Yahoo-Principal-Auth",
            "Access-Control-Allow-Methods", "OPTIONS,GET,PUT,DELETE,POST",
            "Access-Control-Allow-Credentials", "true"
    );

}

@@ -235,26 +235,30 @@
 ava.
-u
 ti
-l.Map;%0A
+me.Duration;
 %0Aimport 
 stat
@@ -257,15 +257,8 @@
 ort 
-static 
 java
@@ -267,32 +267,11 @@
 til.
-concurrent.TimeUnit.DAYS
+Map
 ;%0A%0A/
@@ -398,22 +398,37 @@
 ng(D
-AYS.to
+uration.ofDays(7).get
 Seconds(
 7));
@@ -423,17 +423,16 @@
 Seconds(
-7
 ));%0A%0A   

Make constant readable