
com.tngtech.keycloakmock.impl.handler.CommonHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mock Show documentation
Show all versions of mock Show documentation
Base module of keycloak-mock
The newest version!
package com.tngtech.keycloakmock.impl.handler;
import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Singleton
public class CommonHandler implements Handler {
private static final Logger LOG = LoggerFactory.getLogger(CommonHandler.class);
@Inject
CommonHandler() {}
@Override
public void handle(@Nonnull RoutingContext routingContext) {
routingContext
.response()
.bodyEndHandler(
aVoid ->
LOG.info(
"{}: {} {}",
routingContext.response().getStatusCode(),
routingContext.request().method().name(),
routingContext.request().uri()))
.putHeader("Access-Control-Allow-Origin", routingContext.request().headers().get("Origin"))
.putHeader("Access-Control-Allow-Methods", "GET,POST")
.putHeader("Access-Control-Allow-Credentials", "true");
routingContext.next();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy