/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you 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 org.apache.cxf.dosgi.samples.security;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A filter that requires a query string of "secure" to invoke the protected resource. Pax-Web whiteboard (if
 * deployed) will attempt to apply this filter to servlets by name or URL, and will complain if neither
 * servletName or urlPatterns are specified. The felix http service whiteboard may do something similar.
 */
@Component //
(//
    service = javax.servlet.Filter.class,
    property = //
    {
     "org.apache.cxf.httpservice.filter=true", "servletNames=none"
    }//
)
public class SampleSecurityFilter implements Filter {

    private static final Logger LOG = LoggerFactory.getLogger(SampleSecurityFilter.class);

    public void destroy() {
        LOG.info("destroy()");
    }

    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
        throws IOException, ServletException {
        if ("secure".equals(((HttpServletRequest)request).getQueryString())) {
            LOG.info("Access granted");
            chain.doFilter(request, response);
        } else {
            LOG.warn("Access denied");
            ((HttpServletResponse)response).sendError(HttpServletResponse.SC_FORBIDDEN);
        }
    }

    public void init(FilterConfig config) {
        LOG.info("init()");
    }
}
