Querying freeRADIUS from Java
Estefania figueroa buitrago
kaoru_chan0212 at hotmail.com
Sat Apr 5 00:41:21 CEST 2014
Hello guys,
thank you very much for your suggestions. I'm really impressed by the amount and quickness. I ended up using TinyRadius and it worked like a charm. Just in case someone have the same question I drop here the code I am using:
---------------------------------------------------
public class RadiusClient {
//check http://wiki.freeradius.org/guide/SQL-HOWTO first
public static void main (String[] args) throws RadiusException{
org.tinyradius.util.RadiusClient radiusClient = new org.tinyradius.util.RadiusClient("127.0.0.1", "testing123");
AccessRequest accessRequest = new AccessRequest("dialrouter", "dialup");
try{
RadiusPacket response = radiusClient.authenticate(accessRequest);
if(response.getPacketType() == RadiusPacket.ACCESS_ACCEPT){
String outs = response.getAttributeValue("Framed-Protocol");
System.out.println(outs);
System.out.println("Authenticated");
}
else if(response.getPacketType() == RadiusPacket.ACCESS_REJECT){
System.out.println("No Authenticated");
}
}catch(IOException e){
e.printStackTrace();
}catch(RadiusException e){
e.printStackTrace();
}
}
}
---------------------------------------------------
To support vendor specific AVPs check this tutorial. It helped me a lot:
http://raihanulislam.wordpress.com/2012/03/25/supporting-vendor-specific-avp-using-tiny-radius-java-client-and-freeradius-server-part-3/
Greetings,
Estefanía
> Message: 2
> Date: Thu, 3 Apr 2014 21:26:52 +0100
> From: <adrian.p.smith at bt.com>
> To: <freeradius-users at lists.freeradius.org>
> Subject: RE: Querying freeRADIUS from Java
> Message-ID:
> <555F5D0F9437EB4EB0E1828E3A271939375E599D8D at EMV65-UKRD.domain1.systemhost.net>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> We use http://tinyradius.sourceforge.net/ for simple a Java Radius client.
>
> From: freeradius-users-bounces+adrian.p.smith=bt.com at lists.freeradius.org [mailto:freeradius-users-bounces+adrian.p.smith=bt.com at lists.freeradius.org] On Behalf Of Estefania figueroa buitrago
> Sent: 03 April 2014 20:30
> To: freeradius-users at lists.freeradius.org
> Subject: Querying freeRADIUS from Java
>
> Hello guys,
>
> I just started to use freeRADIUS. The server is running and working with mySQL just like in this tutorial:
>
> http://wiki.freeradius.org/guide/SQL-HOWTO
>
> What I want to do is really simple. I want to be able to query the server from Java just like radtest does and get response information, for example:
>
> Framed-IP-Address = 2.3.4.1
> Framed-IP-Netmask = 255.255.255.255
> Framed-Routing = Broadcast-Listen
> Framed-Route = "2.3.4.0 255.255.255.248"
> Idle-Timeout = 900
> Service-Type = Framed-User
> Framed-Protocol = PPP
>
> to be processed later also in Java. Is there a way to do this and keep it as simple as possible? I have an application server written in Java (Mobicents) and I only need to obtain authentication information from freeRADIUS to process it later. Sorry if my cuestion isn't pertinent, but I haven't find anything in the wiki. If there is no way to do this, I would be very grateful if you could show another way to do it.
>
> Greetings,
> Estefan?a
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://lists.freeradius.org/mailman/private/freeradius-users/attachments/20140403/137fb69d/attachment-0001.html>
>
> ------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/mailman/private/freeradius-users/attachments/20140404/891b2912/attachment.html>
More information about the Freeradius-Users
mailing list