37 lines
1.1 KiB
Java
37 lines
1.1 KiB
Java
|
package org.gcube.gcat.rest;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
|
||
|
import javax.ws.rs.container.ContainerRequestContext;
|
||
|
import javax.ws.rs.container.ContainerRequestFilter;
|
||
|
import javax.ws.rs.container.ContainerResponseContext;
|
||
|
import javax.ws.rs.container.ContainerResponseFilter;
|
||
|
import javax.ws.rs.container.PreMatching;
|
||
|
import javax.ws.rs.ext.Provider;
|
||
|
|
||
|
import org.gcube.common.authorization.utils.manager.SecretManager;
|
||
|
import org.slf4j.Logger;
|
||
|
import org.slf4j.LoggerFactory;
|
||
|
|
||
|
@Provider
|
||
|
@PreMatching
|
||
|
public class RequestFilter implements ContainerRequestFilter, ContainerResponseFilter {
|
||
|
|
||
|
private final static Logger logger = LoggerFactory.getLogger(RequestFilter.class);
|
||
|
|
||
|
@Override
|
||
|
public void filter(ContainerRequestContext requestContext) throws IOException {
|
||
|
logger.trace("PreMatching RequestFilter");
|
||
|
SecretManager.instance.remove();
|
||
|
SecretManager.instance.get();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
|
||
|
throws IOException {
|
||
|
logger.trace("ResponseFilter");
|
||
|
SecretManager.instance.remove();
|
||
|
}
|
||
|
|
||
|
}
|