hprose / hprose-java

Hprose is a cross-language RPC. This project is Hprose 2.0 for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Security

danielsawan opened this issue · comments

Hi !

I was wondering if there is a built in security while calling a method in hprose. I mean actually i guess the server just bind a port and accept every incoming communication including illegit ones.

You can define an InvokeHandler to prevent illegal clients.

public interface InvokeHandler {
    Promise<Object> handle(String name, Object[] args, HproseContext context, NextInvokeHandler next);
}

You can cast context to HttpContext on servlet server or TcpContext on TCP server. And then, you can get the client IP or something you need.

Thanks, I manage to get the request IP from TcpContext 👍