Class ClientLoginAuthenticator
FishNet client-side authenticator MonoBehaviour for the FishMMO login flow. Thin adapter over the engine-independent ClientAuthenticatorCore state machine: translates abstract send/disconnect/result callbacks into FishNet broadcasts and connection control, and routes incoming FishNet broadcasts back into the core.
public class ClientLoginAuthenticator : Authenticator
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourAuthenticatorClientLoginAuthenticator
- Inherited Members
-
Authenticator.InitializedAuthenticator.NetworkManagerAuthenticator.OnRemoteConnection(NetworkConnection)MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Properties
Client
Reference to the client instance for broadcasting messages.
public Client Client { get; }
Property Value
ConnectionToken
One-time connection token from IPFetch for real-IP recovery on the Login Server. Set before ConnectToServer; null for World/Scene reconnections.
public string ConnectionToken { get; set; }
Property Value
HasAuthToken
Returns whether the client has a stored authentication token for World/Scene server connections.
public bool HasAuthToken { get; }
Property Value
PendingLoginIdentifier
Returns the current login identifier (username or email) if still set. Returns null after credentials are cleared (post-SRP proof or disconnect). Note: .NET strings are immutable and cannot be zeroed, so the identifier remains in managed memory until garbage collected.
public string PendingLoginIdentifier { get; }
Property Value
Methods
ClearAuthToken()
Clears the stored authentication token and zeroes its memory. Call on explicit logout or when the token is no longer needed.
public void ClearAuthToken()
InitializeOnce(NetworkManager)
Initializes the authenticator once with the provided network manager. Registers connection state and broadcast handlers.
public override void InitializeOnce(NetworkManager networkManager)
Parameters
networkManagerNetworkManagerThe network manager instance.
RetryHandshakeAsync()
Resets the authentication state and re-initiates the handshake on the current connection after a randomized jitter delay (0-1s). The jitter prevents all admitted queue clients from sending handshakes simultaneously, which would create a thundering herd at the server's SRP verify channel.
public Task RetryHandshakeAsync()
Returns
Remarks
The connection token from IPFetch is NOT re-sent -- the real IP was already recovered by the initial handshake that triggered queueing.
RevokeAndClearAuthToken()
Best-effort server-side token revocation: if a token is currently stored and
the client connection is active, sends a RevokeTokenBroadcast
to the LoginServer with the raw token bytes. The server will hash and revoke
it via IAuthTokenService. Either way, the local copy is zeroed
immediately so the token cannot be reused by this process.
Safe to call when there is no active connection — the broadcast is simply dropped by FishNet and the local token is still cleared.
public Task RevokeAndClearAuthToken()
Returns
SendTotpCode(string)
Encrypts and sends a TOTP code to the server for two-factor verification during login.
public void SendTotpCode(string code)
Parameters
codestringThe 6-digit TOTP code from the authenticator app.
SendVerifyCode(string, string)
Encrypts and sends an account verification code to the server on the current connection.
public void SendVerifyCode(string username, string verifyCode)
Parameters
usernamestringThe account username to verify.
verifyCodestringThe verification code entered by the user.
SetClient(Client)
Sets the client instance for broadcasting messages.
public void SetClient(Client client)
Parameters
clientClientThe client instance.
SetLoginCredentials(string, string, bool, string, int)
Sets the login credentials for authentication or registration. Returns false if the basic credential format is invalid.
public bool SetLoginCredentials(string username, string password, bool register = false, string email = "", int age = 0)
Parameters
usernamestringThe username.
passwordstringThe password.
registerboolTrue to register a new account; false to login.
emailstringThe email address for multi-factor identification.
ageintThe age for multi-factor identification.
Returns
- bool
trueif credentials were accepted;falseif rejected.
Events
OnAuthenticationResult
Overridden authentication result event (not used on client).
public override event Action<NetworkConnection, bool> OnAuthenticationResult
Event Type
OnClientAuthenticationResult
Client authentication event. Subscribe to receive authentication results from the server.
public event Action<ClientAuthenticationResult> OnClientAuthenticationResult
Event Type
OnTwoFactorSetupReceived
Fired when the server sends 2FA setup data after account creation. Parameters: otpauth URI (for authenticator app), recovery codes array.
public event Action<string, string[]> OnTwoFactorSetupReceived