Class ServerAuthenticator
Authenticates the server itself at startup and owns the server's game session ("slot"). In Offline it is a no-op. In Authenticated it obtains an access token (env or OAuth device flow), then acquires a game session. ReleaseAsync(CancellationToken) frees the slot on shutdown so it does not count against the account's session limit.
public sealed class ServerAuthenticator
- Inheritance
-
ServerAuthenticator
- Inherited Members
Constructors
ServerAuthenticator(ServiceHttpClient, AuthConfig, IShardLogger)
Authenticates the server itself at startup and owns the server's game session ("slot"). In Offline it is a no-op. In Authenticated it obtains an access token (env or OAuth device flow), then acquires a game session. ReleaseAsync(CancellationToken) frees the slot on shutdown so it does not count against the account's session limit.
public ServerAuthenticator(ServiceHttpClient http, AuthConfig config, IShardLogger log)
Parameters
httpServiceHttpClientconfigAuthConfiglogIShardLogger
Properties
AccessToken
public string? AccessToken { get; }
Property Value
ServerIdentityToken
The server's identity token (sent to clients in AuthGrant); null until acquired.
public string? ServerIdentityToken { get; }
Property Value
ServerSessionId
Per-boot identifier used as the audience when requesting player auth grants.
public Guid ServerSessionId { get; }
Property Value
SessionToken
The server's game session token while a slot is held; null otherwise.
public string? SessionToken { get; }
Property Value
Methods
AuthenticateAsync(AuthMode, CancellationToken)
public Task AuthenticateAsync(AuthMode mode, CancellationToken ct = default)
Parameters
modeAuthModectCancellationToken
Returns
ReleaseAsync(CancellationToken)
Release the server's game session slot. Safe to call multiple times; never throws. The refreshed OAuth tokens (not the now-dead session) are persisted so the next start can refresh rather than re-run the device flow.
public Task ReleaseAsync(CancellationToken ct = default)