MCPcopy Create free account
hub / github.com/ctran/TinyRadius / main

Method main

src/main/java/org/tinyradius/test/TestClient.java:26–65  ·  view source on GitHub ↗

Radius command line client. Usage: TestClient hostName sharedSecret userName password @param args arguments @throws Exception

(String[] args)

Source from the content-addressed store, hash-verified

24 * @throws Exception
25 */
26 public static void main(String[] args)
27 throws Exception {
28 if (args.length != 4) {
29 System.out.println("Usage: TestClient hostName sharedSecret userName password");
30 System.exit(1);
31 }
32
33 String host = args[0];
34 String shared = args[1];
35 String user = args[2];
36 String pass = args[3];
37
38 RadiusClient rc = new RadiusClient(host, shared);
39
40 // 1. Send Access-Request
41 AccessRequest ar = new AccessRequest(user, pass);
42 ar.setAuthProtocol(AccessRequest.AUTH_PAP); // or AUTH_CHAP
43 ar.addAttribute("NAS-Identifier", "this.is.my.nas-identifier.de");
44 ar.addAttribute("NAS-IP-Address", "192.168.0.100");
45 ar.addAttribute("Service-Type", "Login-User");
46 ar.addAttribute("WISPr-Redirection-URL", "http://www.sourceforge.net/");
47 ar.addAttribute("WISPr-Location-ID", "net.sourceforge.ap1");
48
49 System.out.println("Packet before it is sent\n" + ar + "\n");
50 RadiusPacket response = rc.authenticate(ar);
51 System.out.println("Packet after it was sent\n" + ar + "\n");
52 System.out.println("Response\n" + response + "\n");
53
54 // 2. Send Accounting-Request
55 AccountingRequest acc = new AccountingRequest("mw", AccountingRequest.ACCT_STATUS_TYPE_START);
56 acc.addAttribute("Acct-Session-Id", "1234567890");
57 acc.addAttribute("NAS-Identifier", "this.is.my.nas-identifier.de");
58 acc.addAttribute("NAS-Port", "0");
59
60 System.out.println(acc + "\n");
61 response = rc.account(acc);
62 System.out.println("Response: " + response);
63
64 rc.close();
65 }
66
67}

Callers

nothing calls this directly

Calls 5

setAuthProtocolMethod · 0.95
authenticateMethod · 0.95
accountMethod · 0.95
closeMethod · 0.95
addAttributeMethod · 0.80

Tested by

no test coverage detected