Home Previous Up Next Index

Murmur::ServerAuthenticator

Overview

interface ServerAuthenticator

Callback interface for server authentication. You need to supply one of these for Server::setAuthenticator. If an added callback ever throws an exception or goes away, it will be automatically removed. Please note that unlike ServerCallback and ServerContextCallback, these methods are called synchronously. If the response lags, the entire murmur server will lag. Also note that, as the method calls are synchronous, making a call to Server or Meta will deadlock the server.

Derived Classes and Interfaces

ServerUpdatingAuthenticator

Operation Index

authenticate
Called to authenticate a user.
getInfo
Fetch information about a user.
nameToId
Map a name to a user id.
idToName
Map a user id to a username.
idToTexture
Map a user to a custom Texture.

Operations

int authenticate(string name, string pw, CertificateList certificates, string certhash, bool certstrong, out string newname, out GroupNameList groups)

Called to authenticate a user. If you do not know the username in question, always return -2 from this method to fall through to normal database authentication. Note that if authentication succeeds, murmur will create a record of the user in it's database, reserving the username and id so it cannot be used for normal database authentication. The data in the certificate (name, email addresses etc), as well as the list of signing certificates, should only be trusted if certstrong is true. Internally, Murmur treats usernames as case-insensitive. It is recommended that authenticators do the same. Murmur checks if a username is in use when a user connects. If the connecting user is registered, the other username is kicked. If the connecting user is not registered, the connecting user is not allowed to join the server.

Parameters

name
Username to authenticate.
pw
Password to authenticate with.
certificates
List of der encoded certificates the user connected with.
certhash
Hash of user certificate, as used by murmur internally when matching.
certstrong
True if certificate was valid and signed by a trusted CA.
newname
Set this to change the username from the supplied one.
groups
List of groups on the root channel that the user will be added to for the duration of the connection.

Return Value

UserID of authenticated user, -1 for authentication failures, -2 for unknown user (fallthrough), -3 for authentication failures where the data could (temporarily) not be verified.

bool getInfo(int id, out UserInfoMap info)

Fetch information about a user. This is used to retrieve information like email address, keyhash etc. If you want murmur to take care of this information itself, simply return false to fall through.

Parameters

id
User id.
info
Information about user. This needs to include at least "name".

Return Value

true if information is present, false to fall through.

int nameToId(string name)

Map a name to a user id.

Parameters

name
Username to map.

Return Value

User id or -2 for unknown name.

string idToName(int id)

Map a user id to a username.

Parameters

id
User id to map.

Return Value

Name of user or empty string for unknown id.

Texture idToTexture(int id)

Map a user to a custom Texture.

Parameters

id
User id to map.

Return Value

User texture or an empty texture for unknwon users or users without textures.


Home Previous Up Next Index