#include <TwoWayAuthentication.h>
Public Member Functions | |
bool | AddPassword (RakNet::RakString identifier, RakNet::RakString password) |
Adds a password to the list of passwords the system will accept. | |
bool | Challenge (RakNet::RakString identifier, AddressOrGUID remoteSystem) |
Challenge another system for the specified identifier. | |
void | Clear (void) |
Free all memory. | |
virtual void | Update (void) |
Update is called every time a packet is checked for . | |
virtual PluginReceiveResult | OnReceive (Packet *packet) |
virtual void | OnRakPeerShutdown (void) |
Called when RakPeer is shutdown. | |
virtual void | OnClosedConnection (const SystemAddress &systemAddress, RakNetGUID rakNetGUID, PI2_LostConnectionReason lostConnectionReason) |
Given two systems, each of whom known a common password / identifier pair, verify the password without transmitting it This can be used to determine what permissions are should be allowed to the other system If the other system should not send any data until authentication passes, you can use the MessageFilter plugin for this. Call MessageFilter::SetAllowMessageID() including ID_TWO_WAY_AUTHENTICATION_NEGOTIATION when doing so. Also attach MessageFilter first in the list of plugins
bool RakNet::TwoWayAuthentication::AddPassword | ( | RakNet::RakString | identifier, | |
RakNet::RakString | password | |||
) |
Adds a password to the list of passwords the system will accept.
Each password, which is secret and not transmitted, is identified by identifier. identifier is transmitted in plaintext with the request. It is only needed because the system supports multiple password. It is used to only hash against once password on the remote system, rather than having to hash against every known password.
[in] | identifier | A unique identifier representing this password. This is transmitted in plaintext and should be considered insecure |
[in] | password | The password to add |
bool RakNet::TwoWayAuthentication::Challenge | ( | RakNet::RakString | identifier, | |
AddressOrGUID | remoteSystem | |||
) |
Challenge another system for the specified identifier.
After calling Challenge, you will get back ID_TWO_WAY_AUTHENTICATION_SUCCESS, ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_TIMEOUT, or ID_TWO_WAY_AUTHENTICATION_OUTGOING_CHALLENGE_FAILED ID_TWO_WAY_AUTHENTICATION_SUCCESS will be returned if and only if the other system has called AddPassword() with the same identifier pair as this system.
[in] | identifier | A unique identifier representing this password. This is transmitted in plaintext and should be considered insecure |
virtual void RakNet::TwoWayAuthentication::OnClosedConnection | ( | const SystemAddress & | systemAddress, | |
RakNetGUID | rakNetGUID, | |||
PI2_LostConnectionReason | lostConnectionReason | |||
) | [virtual] |
Called when a connection is dropped because the user called RakPeer::CloseConnection() for a particular system
[in] | systemAddress | The system whose connection was closed |
[in] | rakNetGuid | The guid of the specified system |
[in] | lostConnectionReason | How the connection was closed: manually, connection lost, or notification of disconnection |
Reimplemented from RakNet::PluginInterface2.
virtual PluginReceiveResult RakNet::TwoWayAuthentication::OnReceive | ( | Packet * | packet | ) | [virtual] |
OnReceive is called for every packet.
[in] | packet | the packet that is being returned to the user |
Reimplemented from RakNet::PluginInterface2.