// Path: acmeair-customer-common/src/main/java/com/acmeair/entities/CustomerSession.java
// public interface CustomerSession {
// 
// 	String SESSIONID_COOKIE_NAME = "sessionid";
// 
// 	String getId();
// 
// 
// 	String getCustomerid();
// 
// 
// 	Date getLastAccessedTime();
// 	
// 
// 	Date getTimeoutTime();
// 
// 	
// }
// 
// Path: acmeair-services/src/main/java/com/acmeair/service/AuthenticationService.java
// public interface AuthenticationService {
//     CustomerSession validateCustomerSession(String sessionId);
// }


import com.acmeair.entities.CustomerSession;
import com.acmeair.service.AuthenticationService;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import java.io.IOException;
import java.util.Arrays;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
/*******************************************************************************
* Copyright (c) 2013 IBM Corp.
*
* 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 com.acmeair.web;


@Component
@Profile({"!test"})
public class RESTCookieSessionFilter extends ZuulFilter {
	private static final Logger logger = LoggerFactory.getLogger(RESTCookieSessionFilter.class);
	
	private static final String LOGIN_USER  = "acmeair.login_user";
	private static final String LOGIN_PATH  = "/rest/api/login";
	private static final String LOGOUT_PATH = "/rest/api/login/logout";
	private static final String LOADDB_PATH = "/rest/api/loaddb";
	private static final String CONFIG_PATH = "/info/config/";
	private static final String LOADER_PATH = "/info/loader/";
	
	@Autowired
// Path: acmeair-customer-common/src/main/java/com/acmeair/entities/CustomerSession.java
// public interface CustomerSession {
// 
// 	String SESSIONID_COOKIE_NAME = "sessionid";
// 
// 	String getId();
// 
// 
// 	String getCustomerid();
// 
// 
// 	Date getLastAccessedTime();
// 	
// 
// 	Date getTimeoutTime();
// 
// 	
// }
// 
// Path: acmeair-services/src/main/java/com/acmeair/service/AuthenticationService.java
// public interface AuthenticationService {
//     CustomerSession validateCustomerSession(String sessionId);
// }


// Path: acmeair-webapp/src/main/java/com/acmeair/web/RESTCookieSessionFilter.java
import com.acmeair.entities.CustomerSession;
import com.acmeair.service.AuthenticationService;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import java.io.IOException;
import java.util.Arrays;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

/*******************************************************************************
* Copyright (c) 2013 IBM Corp.
*
* 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 com.acmeair.web;


@Component
@Profile({"!test"})
public class RESTCookieSessionFilter extends ZuulFilter {
	private static final Logger logger = LoggerFactory.getLogger(RESTCookieSessionFilter.class);
	
	private static final String LOGIN_USER  = "acmeair.login_user";
	private static final String LOGIN_PATH  = "/rest/api/login";
	private static final String LOGOUT_PATH = "/rest/api/login/logout";
	private static final String LOADDB_PATH = "/rest/api/loaddb";
	private static final String CONFIG_PATH = "/info/config/";
	private static final String LOADER_PATH = "/info/loader/";
	
	@Autowired
	private AuthenticationService authenticationService;