<div class="gmail_quote">On Thu, Dec 22, 2011 at 3:08 PM, <span dir="ltr"><<a href="mailto:jeissonfabian.pr@gmail.com" target="_blank">jeissonfabian.pr@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yeah,<br>
I found a lot of problems with JRadius, and tried TinyRadius, it's easy!<br>
<br>
And It didn't present any problem.<br>
<br>
Thanks!<br></blockquote><div> </div><div>I use this BeanShell script (<a href="http://www.beanshell.org/" target="_blank">www.beanshell.org</a>)
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.<br>
<br>
java -cp bsh-2.0b4.jar:TinyRadius-1.0.jar:commons-logging-1.1.1.jar bsh.Interpreter radius.bsh<br>
<br>
---radius.bsh---<br>
import org.tinyradius.util.*;<br>
import org.tinyradius.packet.*;<br>
<br>
String radiusHost = "192.168.0.1";<br>
String radiusSharedSecret = "sharedsecret";<br>
String radiusUser = "user";<br>
String radiusPassword = "password";<br>
<br>
RadiusClient rc = new RadiusClient(radiusHost, radiusSharedSecret);<br>
rc.setRetryCount(1);<br>
AccessRequest ar = new AccessRequest(radiusUser, radiusPassword);<br>
ar.setAuthProtocol(AccessRequest.AUTH_PAP);<br>
<br>
try {<br>
RadiusPacket response = rc.authenticate(ar);<br>
if (response.getPacketType() == RadiusPacket.ACCESS_ACCEPT) {<br>
msg = "Success: Expected radius response";<br>
}<br>
else {<br>
msg = "Warning: RADIUS authentication did not return expected response " + response.getPacketType();<br>
}<br>
}<br>
catch(Exception e) {<br>
msg = "Error: RADIUS authentication failed " + e ;<br>
}<br>
<br>
print (msg);<br>
---end beanshell script---<br>
<br>
Cheers<br>
<br>
Peter<br></div></div>