-
-
Notifications
You must be signed in to change notification settings - Fork 307
Basic Authentication
[WORK IN PROGRESS] This page is a work in progress.
- Implement IUserAuthenticator.
- Add the new authenticator before calling
Connecton the networker.- use the
SetAuthenticatormethod
- use the
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();
}
}Work in progress
When someone connects to the server they send a request to the server "Hey give me a network id" which is read by the server and if there is an authenticator set then it will run this piece of code in UDPServer.cs lines 542-545
The client will then get this challenge message and run this pieces of code in UDPClient.cs lines 439-447 and send back to the server the data you specify that will identify your player.
When the server gets the challenge response it will run this piece of code in UDPServer.cs lines 553-561 to check that what the client sent back is valid and the client can be allowed on the server and depending on what you do in verifyrepsonse you have two callbacks to call one to authorize the client the other to reject
Note the AuthUser and RejectUser callback methods in authenticator.VerifyResponse(this, currentPlayer, frame.StreamData, AuthUser, RejectUser); on line 559 of the UDPServer.cs file
they are these two methods
Getting Started
Network Contract Wizard (NCW)
Remote Procedure Calls (RPCs)
Unity Integration
Basic Network Samples
Scene Navigation
Master Server
Netcoding Design Patterns
Troubleshooting
Miscellaneous
-
Connection Cycle Events
-
Rewinding
-
Network Logging
-
Working with Multiple Sockets
-
Modify Master and Standalone servers
-
NAT Hole Punching
-
UDP LAN Discovery
-
Offline Mode
-
Ping Pong
-
Lobby System
-
Upgrading Forge Remastered to Develop branch or different version
-
Forge Networking Classic to Remastered Migration Guide
-
Script to easily use Forge Networking from sources
-
Run Two Unity Instances with Shared Assets for Easiest Dedicated Client Workflow