PAP Authentication

PAP authentication is the simplest RADIUS authentication method, and is the default and is readily handled by the client and server.

Here's an example for the server:

// If there's a User-Password attribute simply compare
// the encoded local password against the password
// found in the User-Password attribute:

// Get the local password somehow:
String password = getThePassword();

// Convert to UTF8 bytes.
byte passwordBytes[] = rauth.getBytes(password);

// Check to see if the User-Password attribute exists
// and if so compare it for a PAP authentication.
if (inList.exists(Attribute.User_Password))
	result = auth.cmp(auth.trim(auth.getDecodedUserPassword()),
		passwordBytes);

If the result is True the authentication has succeeded.

On the client side this code will do:

// Authenticate using the name and password and any other
// necessary attributes:

result = rauth.authenticate(name, password, attrList);

// If the result is PacketType.Access_Accept the authentication
// succeeded.