Skip to content

Basic Authentication

Peter Halasz edited this page Jun 17, 2019 · 1 revision

[WORK IN PROGRESS] This page is a work in progress.

  • Implement IUserAuthenticator.
  • Add the new authenticator before calling Connect on the networker.
    • use the SetAuthenticator method
public void IssueChallenge(NetWorker networker, NetworkingPlayer player, Action<NetworkingPlayer, BMSByte> issueChallengeAction, Action<NetworkingPlayer> skipAuthAction)
{
    issueChallengeAction(player, new BMSByte());
}
public void AcceptChallenge(NetWorker networker, BMSByte challenge, Action<BMSByte> authServerAction, Action rejectServerAction)
{
    Ticket = Client.Instance.Auth.GetAuthSessionTicket();
    var data = ObjectMapper.BMSByte(Client.Instance.SteamId, Ticket.Data);
    authServerAction(data);
}
public void VerifyResponse(NetWorker networker, NetworkingPlayer player, BMSByte response, Action<NetworkingPlayer> authUserAction, Action<NetworkingPlayer> rejectUserAction)
{
    ulong steamid = response.GetBasicType<ulong>();
    byte[] ticketBinary = response.GetByteArray(response.StartIndex());

    if (AuthUser(steamid, ticketBinary))
    {
        authUserAction();
    } else {
        rejectUserAction();
    }
}

Home

Getting Started
Network Contract Wizard (NCW)
Network Object
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
NetWorker
Master Server
Web Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
Clone this wiki locally
You can’t perform that action at this time.