// Path: com.swookiee.runtime.authentication/src/main/java/com/swookiee/runtime/authentication/AuthenticationService.java
// public interface AuthenticationService {
// 
//     boolean validateUserCredentials(String username, String password);
// 
// }


import java.io.IOException;
import java.net.URL;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.DatatypeConverter;
import org.osgi.service.http.HttpContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.swookiee.runtime.authentication.AuthenticationService;
/*******************************************************************************
 * Copyright (c) 2014 Lars Pfannenschmidt, Tobias Ullrich and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Lars Pfannenschmidt - initial API and implementation, ongoing development and documentation
 *    Tobias Ullrich - Send correct header for basic auth
 *******************************************************************************/

package com.swookiee.runtime.ewok.auth;





/**
 * This HttpContext provides a simple Basic-Auth mechanism. It is using {@link AuthenticationService} to validate user
 * credentials.
 * 
 */
public class BasicAuthHttpContext implements HttpContext {

    private static final Logger logger = LoggerFactory.getLogger(BasicAuthHttpContext.class);

// Path: com.swookiee.runtime.authentication/src/main/java/com/swookiee/runtime/authentication/AuthenticationService.java
// public interface AuthenticationService {
// 
//     boolean validateUserCredentials(String username, String password);
// 
// }


// Path: com.swookiee.runtime.ewok/src/main/java/com/swookiee/runtime/ewok/auth/BasicAuthHttpContext.java
import java.io.IOException;
import java.net.URL;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.bind.DatatypeConverter;
import org.osgi.service.http.HttpContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.swookiee.runtime.authentication.AuthenticationService;

/*******************************************************************************
 * Copyright (c) 2014 Lars Pfannenschmidt, Tobias Ullrich and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Lars Pfannenschmidt - initial API and implementation, ongoing development and documentation
 *    Tobias Ullrich - Send correct header for basic auth
 *******************************************************************************/

package com.swookiee.runtime.ewok.auth;





/**
 * This HttpContext provides a simple Basic-Auth mechanism. It is using {@link AuthenticationService} to validate user
 * credentials.
 * 
 */
public class BasicAuthHttpContext implements HttpContext {

    private static final Logger logger = LoggerFactory.getLogger(BasicAuthHttpContext.class);

    private final AuthenticationService authenticationService;