/* * * * Copyright 2013 Jive Software * * * * 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.jivesoftware.sdk.service.filter; import com.jivesoftware.sdk.service.BaseContainerRequestFilter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.ext.Provider; import java.io.IOException; /** * Created by rrutan on 1/30/14. */ @Provider @JiveSignedFetchValidation public class JiveSignedFetchValidationRequestFilter extends BaseContainerRequestFilter { private static final Logger log = LoggerFactory.getLogger(JiveSignedFetchValidationRequestFilter.class); @Autowired private JiveSignedFetchValidator jiveSignedFetchValidator; @Override public void filter(ContainerRequestContext containerRequestContext) throws IOException { if (log.isTraceEnabled()) { log.trace("filter called"); } if (log.isDebugEnabled()) { log.debug(getJsonBody(containerRequestContext)); } // end if jiveSignedFetchValidator.authenticate(containerRequestContext); } // end filter } // end class