[Minor] Allow to call VersionQuery REST API without certificate...
but only if enabled in AuthenticationRequestFilter
This commit is contained in:
parent
04f4fed0ba
commit
875c9dd27f
|
@ -1,12 +1,12 @@
|
|||
/*
|
||||
* Copyright 2015 Robert von Burg <eitch@eitchnet.ch>
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
|
@ -23,10 +23,9 @@ import javax.ws.rs.core.Context;
|
|||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
import li.strolch.agent.api.ComponentContainer;
|
||||
import li.strolch.agent.api.VersionQueryResult;
|
||||
import li.strolch.privilege.model.Certificate;
|
||||
import li.strolch.rest.RestfulStrolchComponent;
|
||||
import li.strolch.rest.StrolchRestfulConstants;
|
||||
|
||||
/**
|
||||
* @author Robert von Burg <eitch@eitchnet.ch>
|
||||
|
@ -38,11 +37,8 @@ public class VersionQuery {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public Response getVersions(@Context HttpServletRequest request) {
|
||||
|
||||
Certificate cert = (Certificate) request.getAttribute(StrolchRestfulConstants.STROLCH_CERTIFICATE);
|
||||
RestfulStrolchComponent instance = RestfulStrolchComponent.getInstance();
|
||||
instance.getSessionHandler().validate(cert);
|
||||
|
||||
VersionQueryResult versionQueryResult = instance.getContainer().getAgent().getVersion();
|
||||
ComponentContainer container = RestfulStrolchComponent.getInstance().getContainer();
|
||||
VersionQueryResult versionQueryResult = container.getAgent().getVersion();
|
||||
return Response.ok(versionQueryResult.toJson().toString(), MediaType.APPLICATION_JSON).build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue