On Thu, Dec 22, 2011 at 3:08 PM, <jeissonfabian.pr@gmail.com> wrote:
Yeah,
I found a lot of problems with JRadius, and tried TinyRadius, it's easy!

And It didn't present any problem.

Thanks!
 
I use this BeanShell script (www.beanshell.org) which allows for Java code to be executed from the command line without needing to be complied:  Easy for remote server testing multi-platform without needing radclient and just java installed on the remote end.

java -cp bsh-2.0b4.jar:TinyRadius-1.0.jar:commons-logging-1.1.1.jar bsh.Interpreter radius.bsh

---radius.bsh---
import org.tinyradius.util.*;
import org.tinyradius.packet.*;

String radiusHost         = "192.168.0.1";
String radiusSharedSecret = "sharedsecret";
String radiusUser         = "user";
String radiusPassword     = "password";

RadiusClient rc = new RadiusClient(radiusHost, radiusSharedSecret);
rc.setRetryCount(1);
AccessRequest ar = new AccessRequest(radiusUser, radiusPassword);
ar.setAuthProtocol(AccessRequest.AUTH_PAP);

try {
   RadiusPacket response = rc.authenticate(ar);
   if (response.getPacketType() == RadiusPacket.ACCESS_ACCEPT) {
      msg = "Success: Expected radius response";
   }
   else {
      msg = "Warning: RADIUS authentication did not return expected response " + response.getPacketType();
   }
}
catch(Exception e) {
   msg = "Error: RADIUS authentication failed " + e ;
}

print (msg);
---end beanshell script---

Cheers

Peter