Class SrpAccountManager<TConnection>
- Namespace
- FishMMO.Auth.Implementation
- Assembly
- FishMMO-ServerAuth.dll
SRP-specific account manager for LoginServer authentication.
Extends AccountManager<TConnection> with SRP data population,
connection account creation, and periodic sweep of stale unauthenticated connections.
Auth state machine methods (TryAdvanceAuthState, HasAuthState)
are inherited from the base AccountManager<TConnection>.
public class SrpAccountManager<TConnection> : AccountManager<TConnection>, ISrpAccountManager<TConnection>, IAccountManager<TConnection>
Type Parameters
TConnectionThe type representing a network connection.
- Inheritance
-
AccountManager<TConnection>SrpAccountManager<TConnection>
- Implements
-
ISrpAccountManager<TConnection>IAccountManager<TConnection>
- Derived
- Inherited Members
Constructors
SrpAccountManager(string)
Initializes a new SrpAccountManager.
public SrpAccountManager(string logPrefix = "SrpAccountManager")
Parameters
logPrefixstringPrefix used in diagnostic log messages.
Methods
AddConnectionAccount(TConnection, string, string, string, string, AccessLevel, bool)
Populates SRP authentication data on an existing connection's AccountData. Requires the connection to be in VerifyPending state (set by the verify broadcast handler). On success, advances the state to WaitingForProof and registers the account name mappings.
public bool AddConnectionAccount(TConnection connection, string accountName, string publicClientEphemeral, string salt, string verifier, AccessLevel accessLevel, bool isUnverified = false)
Parameters
connectionTConnectionThe network connection.
accountNamestringThe account name.
publicClientEphemeralstringThe public ephemeral value from the client.
saltstringThe salt for SRP.
verifierstringThe verifier for SRP.
accessLevelAccessLevelThe access level for the account.
isUnverifiedbool
Returns
- bool
trueif SRP data was set and state advanced;falseif the connection was not in the expected state.
ClearSrpState(TConnection)
Clears SRP state for a connection while preserving account mappings and access level. Calls Clear() to null sensitive string references, then nulls the SrpData reference itself via ClearSrpData(). Use this after SRP success to remove sensitive SRP material from memory.
public void ClearSrpState(TConnection connection)
Parameters
connectionTConnectionThe connection whose SRP state will be cleared.
SweepUnauthenticatedConnections(TimeSpan, Func<TConnection, bool>, int, int)
Sweeps and removes stale unauthenticated connection state to bound SRP/encryption memory growth. Authenticated connections are only untracked from the unauthenticated timer map.
public int SweepUnauthenticatedConnections(TimeSpan maxUnauthenticatedAge, Func<TConnection, bool> isAuthenticated, int maxScan, int maxRemovals)
Parameters
maxUnauthenticatedAgeTimeSpanMaximum allowed age for unauthenticated state.
isAuthenticatedFunc<TConnection, bool>Connection authentication predicate.
maxScanintMaximum tracked entries to evaluate this sweep.
maxRemovalsintMaximum stale entries to purge this sweep.
Returns
- int
Number of stale unauthenticated entries purged.