BeardedManStudios / ForgeNetworkingRemastered

See various forks, also please join the Forge Community fork of Forge Alloy! -> https://github.com/ForgeAlloyCommunity/ForgeAlloy
https://twitter.com/FarrisFaulds
Apache License 2.0
1.49k stars 311 forks source link

Add password user authenticator #387

Open NoTuxNoBux opened 3 years ago

NoTuxNoBux commented 3 years ago

This adds a simple password user authenticator.

I followed the wiki on authentication to build this and tested it working. It wasn't hard to implement yourself, but password authentication seems like the most common use case most people will need, so this makes it slightly easier to get started.

I've combined client and server handling here as the most common use case is using Unity for everything, but this class can also be used on stand-alone non-Unity servers without changes. Seeing as clients only (appear to) need AcceptChallenge, it may be interesting to split IUserAuthenticator into a server and a client counterpart in the future.

Open question: do we need a timing-safe string comparison for security reasons? I did a quick search, but .NET does not appear to have this built-in, though I may have missed it.