I have pure FreeRADIUS server and JRadius client. I've written this example code:
RadiusClient radiusClient = null;
try {
radiusClient = new RadiusClient(InetAddress.getByName("MY_HOSTNAME"),
"MY_SHARED_SECRET");
radiusClient.setAuthPort(1812);
radiusClient.setAcctPort(1813);
} catch (UnknownHostException e) {
// DO SOMETHING
}
AttributeList attributeList = new AttributeList();
attributeList.add(new Attr_UserName("test"));
attributeList.add(new Attr_CryptPassword("teH0wLIpW0gyQ"));
// AND SO ON
RadiusPacket request = new AccessRequest(radiusClient, attributeList);
RadiusPacket reply = null;
try {
reply = radiusClient.authenticate((AccessRequest) request,
new PAPAuthenticator(), 5);
} catch (UnknownAttributeException e) {
// DO SOMETHING
} catch (RadiusException e) {
// DO SOMETHING
}
// MORE CODE FOLLOWS
and I got this:
Exception in thread "main" java.lang.NullPointerException
at net.jradius.client.auth.PAPAuthenticator.processRequest(PAPAuthenticator.java:46)
at net.jradius.client.RadiusClient.authenticate(RadiusClient.java:323)
at rc.Rc.main(Rc.java:65)
Any help will be appreciated.
Add the plain text
Add the plain text Attr_UserPassword() instead of the CryptPassword. The authenticator will take the plain text password and do what is needed for the specified authenticator.
Thank you, David. It works!
Thank you, David. It works!