1

我在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

4

1 回答 1

1

在使用 JRadius 库之前,应该加载一个 JRadius 字典,如下所示。

AttributeFactory.loadAttributeDictionary("net.jradius.dictionary.AttributeDictionaryImpl");

此外,确保您已将 JRadius Dictionary (jradius-dictionary-.jar) 添加到您的类路径中。

于 2014-04-09T13:04:49.647 回答