gpt4 book ai didi

Java - 未知属性 MS-CHAP-Challenge

转载 作者:太空宇宙 更新时间:2023-11-04 06:55:02 27 4
gpt4 key购买 nike

我正在关注this 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)

我已经添加了所有 jar 并导入了。

我的代码:

        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 )

最佳答案

在使用 JRadius 库之前,应按如下方式加载 JRadius 字典。

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

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

关于Java - 未知属性 MS-CHAP-Challenge,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22863893/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com