Authentication Required Vertx

79 views Asked by At

The problem is when I write a simple query to this verticle I get this response.

Request:

curl -X GET http://localhost:8080/v1/calculation/DELPHI_METHOD_FORECAST
   -H 'Content-Type: application/json'
   -d '{"pessimisticMark":5,"optimisticMark":10}'

Response:

<html><head><meta http-equiv='refresh' content='1;url=/login?from=%2Fv1%2Fcalculation%2FDELPHI_METHOD_FORECAST'/><script>window.location.replace('/login?from=%2Fv1%2Fcalculation%2FDELPHI_METHOD_FORECAST');</script></head><body style='background-color:white; color:white;'>


Authentication required
<!--
-->

</body></html> 

Verticle:

public class ExpertMarkCalculationController extends AbstractVerticle {

    @Override
    public void start() {
        Router router = Router.router(vertx);
        router.put("/v1/calculate/:methodName").handler(this::calculateForecast);

        vertx.createHttpServer().requestHandler(router).listen(8080);
    }

    void calculateForecast(RoutingContext ctx) {
        MethodType methodType = MethodType.valueOf(ctx.pathParam("methodName"));
        JsonObject jsonMethodData = ctx.getBodyAsJson();
        MethodData methodData = MethodDataParser.parseJsonToMethodData(jsonMethodData, methodType);
        BasicExpertForecastCalculationService service = MethodMappingHandler.getForecastCalculationService(methodType);
        service.process(methodData);
        ctx.response().putHeader("content-type", "application/json").
                end(MethodDataParser.parseMethodDataToJson(methodData, methodType));
    }
}

As you can see there is no security configuration.

0

There are 0 answers