Test Client - kspviswa/aaaEngine GitHub Wiki
aaaEngine is an library that takes care of protocol abstracted AAA processing. As of today, aaaEngine implements RADIUS, TACACS+ protocol and have ambitious plans to implement other AAA protocols in future.
The library is well designed to provide an intuitive user experience for the API users.
In order to use this library, All you need is to have the libaaaEngineLib.so
and the include files that are available under api
folder ( specifically CEngine.h
).
/*
* testClient.cpp
*
* Created on: 17 Nov 2015
* Author: kspviswa
*/
#include <iostream>
#include "CEngine.h"
using namespace std;
using namespace aaa;
int main()
{
CEngine theEngine;
CProperties theConn;
theConn.nPort = 49;
theConn.sDevice = "eth0";
theConn.sHost = "127.0.0.1";
theConn.sKey = "tac_test";
theConn.sPass = "test";
theConn.sUser = "test";
cout << "Triggering Authentication using TACACS+ Protocol" << endl;
theEngine.setProtocolType(TACACS_PLUS_STACK);
if(theEngine.initRequest(theConn) == PROT_SUCCESS)
{
cout << "Init Succeeded" << endl;
}
else
{
cout << "Init Failed" << endl;
}
theEngine.prepareAndFireRequest();
if(theEngine.getResult() == PROT_SUCCESS)
{
cout << "Authentication Success" << endl;
}
else
{
cout << "Authentication Failed" << endl;
}
cout << "Triggering Authentication using RADIUS Protocol" << endl;
theConn.sKey = "testing123";
theConn.nPort = 1812;
theEngine.setProtocolType(RADIUS_STACK);
if(theEngine.initRequest(theConn) == PROT_SUCCESS)
{
cout << "Init Succeeded" << endl;
}
else
{
cout << "Init Failed" << endl;
}
theEngine.setData("User-Name", theConn.sUser);
theEngine.setData("User-Password", theConn.sPass);
theEngine.prepareAndFireRequest();
if(theEngine.getResult() == PROT_SUCCESS)
{
cout << "Authentication Success" << endl;
}
else
{
cout << "Authentication Failed" << endl;
}
}