如何使用Java与RADIUS服务器通信

时间:2019-06-14 06:29:02

标签: java tinyradius

在执行 communication / authenticate 方法时,发送 Access-Request

时出现错误

我遵循与http://tinyradius.sourceforge.net/

中所述的相同步骤
    RadiusClient rc=new RadiusClient(InetAddress.getByName("server 
                            address").getHostName(),"sharedSecret");

    AccessRequest accessRequest=new AccessRequest("someName$3", "TWffeicH");
    accessRequest.setAuthProtocol(AccessRequest.AUTH_PAP);
    accessRequest.addAttribute("NAS-Port-Id", "my machines' IP address");
    accessRequest.addAttribute("NAS-IP-Address", "NAS IP Address");
    accessRequest.addAttribute("Service-Type", "Login-User");

    RadiusPacket response=rc.authenticate(accessRequest);

我得到的例外是;

2019-06-14 11:04:23.349  INFO 11244 --- [nio-8080-exec-1] org.tinyradius.util.RadiusClient         : communication failure, retry 1
2019-06-14 11:04:26.350  INFO 11244 --- [nio-8080-exec-1] org.tinyradius.util.RadiusClient         : communication failure, retry 2
2019-06-14 11:04:29.351 ERROR 11244 --- [nio-8080-exec-1] org.tinyradius.util.RadiusClient         : communication failure (timeout), no more retries
2019-06-14 11:04:29.376 ERROR 11244 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[.[dispatcherServlet]      : Servlet.service() for servlet [dispatcherServlet] in context with path [/tinyradius] threw exception

java.net.SocketTimeoutException: Receive timed out

0 个答案:

没有答案