use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method reportCompleting_allowedForSameUUID.
@Test
void reportCompleting_allowedForSameUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("reportCompleting", new Class[] { AgentRuntimeInfo.class, JobIdentifier.class, JobResult.class }, new Object[] { agent, null, null }));
invoker.handleRequest(req, res);
verify(target, only()).reportCompleting(agent, null, null);
assertEquals(SC_OK, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporterTest method ping_allowedForSameUUID.
@Test
void ping_allowedForSameUUID() throws Exception {
final AgentRuntimeInfo agent = runtimeInfo(AGENT_UUID);
final AgentRemoteInvokerServiceExporter invoker = deserializingWith(new RemoteInvocation("ping", new Class[] { AgentRuntimeInfo.class }, new Object[] { agent }));
invoker.handleRequest(req, res);
verify(target, only()).ping(agent);
assertEquals(SC_OK, res.getStatus());
}
use of org.springframework.remoting.support.RemoteInvocation in project gocd by gocd.
the class AgentRemoteInvokerServiceExporter method handleRequest.
@Override
public void handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
if (rejectRMI()) {
// yes, ideally, this should be short-circuited in the agent auth filter, but keeping this logic here has
// some advantages:
// - it keeps all deprecated RMI logic in one place so it's easier to remove (just remove this class)
// - it's 100% reliable by virtue of its proximity to the RMI invocation code and can't be thwarted by
// some clever URI encoding to circumvent the uri path test that we would need to write at the filter
// level in order to selectively apply this logic to the RMI endpoint and not the JSON API endpoint
reject(response, SC_GONE, "This RMI endpoint is disabled.");
return;
}
try {
RemoteInvocation invocation = readRemoteInvocation(request);
if (!authorized(request, response, invocation)) {
return;
}
RemoteInvocationResult result = invokeAndCreateResult(invocation, getProxy());
writeRemoteInvocationResult(request, response, result);
} catch (ClassNotFoundException ex) {
throw new NestedServletException("Class not found during deserialization", ex);
}
}
use of org.springframework.remoting.support.RemoteInvocation in project shiro by apache.
the class SecureRemoteInvocationFactoryTest method testSessionManagerProxyStartRemoteInvocation.
@Test
public void testSessionManagerProxyStartRemoteInvocation() throws Exception {
SecureRemoteInvocationFactory factory = new SecureRemoteInvocationFactory();
MethodInvocation mi = createMock(MethodInvocation.class);
Method startMethod = getMethod("start", SessionManager.class);
expect(mi.getMethod()).andReturn(startMethod).anyTimes();
Object[] args = { "localhost" };
expect(mi.getArguments()).andReturn(args).anyTimes();
replay(mi);
RemoteInvocation ri = factory.createRemoteInvocation(mi);
verify(mi);
assertNull(ri.getAttribute(SecureRemoteInvocationFactory.SESSION_ID_KEY));
}
Aggregations