我在java中按照这个小例子来测试JRadius客户端。但我不断收到此错误:
Exception in thread "main" net.sf.jradius.exception.UnknownAttributeException: Unknown attribute MS-CHAP-Challenge
at net.sf.jradius.packet.attribute.AttributeFactory.newAttribute(Unknown Source)
at net.sf.jradius.client.auth.MSCHAPv2Authenticator.processRequest(Unknown Source)
at net.sf.jradius.client.RadiusClient.authenticate(Unknown Source)
at lu.restena.zimbra.RestenaAuthenticator.main(RestenaAuthenticator.java:94)
我已经添加了所有的罐子和进口。
我的代码:
InetAddress remoteInetAddress = InetAddress.getByName(RADIUSname); RadiusClient radiusClient; radiusClient = new RadiusClient( remoteInetAddress, // InetAddress - Address of remote RADIUS Server sharedSecret); // String - Shared Secret for remote RADIUS Server AttributeList attributeList; attributeList = new AttributeList(); attributeList.add(new Attr_UserName(username)); RadiusAuthenticator auth = RadiusClient.getAuthProtocol("mschapv2"); RadiusPacket request; request = new AccessRequest(radiusClient, attributeList); request.addAttribute(new Attr_UserPassword(password)); RadiusPacket reply = radiusClient.authenticate((AccessRequest) request, auth, 5);
错误是:
RadiusPacket reply = radiusClient.authenticate((AccessRequest) request, auth, 5);
有人知道为什么吗?(我是 JRadius 的新手)(MSCHAPv2Authenticator.java)