Beispiel #1
0
    private IEnumerator DelayAuthenticationApproval(float delayTime, AuthUnit authUnit, AuthResponse msg)
    {
        Debug.Log("Delaying authentication response");

        yield return(new WaitForSeconds(delayTime));

        ApproveAuthentication(authUnit.connection, msg);
    }
Beispiel #2
0
 public UsersService(
     AuthUnit unit,
     IUserAccessor user,
     ICacheProvider cache
     ) : base(unit)
 {
     Unit       = unit;
     _user      = user;
     this.cache = cache;
 }
Beispiel #3
0
    private void ClientAuthMessageHandler(NetworkConnection connection, AuthRequest authMessage)
    {
        Debug.Log("Client wants to be authenticated: " + authMessage.playerData.steamName + " - " + authMessage.playerData.id);



        Debug.Log("Checking for server ban from the path " + ServerData.bansPath);

        connection.authenticationData = authMessage.playerData;



        if (ServerData.Config.IdPresent(authMessage.playerData.id, ServerData.bansPath))
        {
            Debug.Log("Player is banned. Kicking them.");

            AuthResponse response = new AuthResponse
            {
                message  = "Server banned!",
                accepted = false,
            };

            FailAuthentication(connection, response);
        }
        else
        {
            Debug.Log("They aren't server banned.");



            Debug.Log("Authenticating with steam...");


            // Keep track of this client's information temporarily so we can trace back to the connection using the steam id returned in the validate callback
            AuthUnit u = new AuthUnit
            {
                connection = connection,
                playerData = authMessage.playerData
            };

            Debug.Log("Created authUnit");


            Debug.Assert(authMessage.ticket.Data != null);

            Debug.Assert(authMessage.playerData.id != 0);


            if (Steamworks.SteamServer.IsValid)
            {
                if (!Steamworks.SteamServer.BeginAuthSession(authMessage.ticket.Data, authMessage.playerData.id))
                {
                    Debug.Log("BeginAuthSession returned false, called bullshit without even having to check with Gabe");

                    return;
                }
                else
                {
                    Debug.Log("Beginning authentication session.");

                    currentAuthUnits.Add(u);
                }
            }
            else
            {
                if (Steamworks.SteamUser.BeginAuthSession(authMessage.ticket.Data, authMessage.playerData.id) != Steamworks.BeginAuthResult.OK)
                {
                    Debug.Log("BeginAuthSession returned false, called bullshit without even having to check with Gabe");


                    switch (Steamworks.SteamUser.BeginAuthSession(authMessage.ticket.Data, authMessage.playerData.id))
                    {
                    case Steamworks.BeginAuthResult.OK:
                        Debug.Log("");
                        break;

                    case Steamworks.BeginAuthResult.InvalidTicket:
                        Debug.Log("Invalid");
                        break;

                    case Steamworks.BeginAuthResult.DuplicateRequest:
                        Debug.Log("Dup");
                        break;

                    case Steamworks.BeginAuthResult.InvalidVersion:
                        Debug.Log("Invalid version");
                        break;

                    case Steamworks.BeginAuthResult.GameMismatch:
                        Debug.Log("Game mismatch");
                        break;

                    case Steamworks.BeginAuthResult.ExpiredTicket:
                        Debug.Log("expired ticket");
                        break;

                    default:
                        break;
                    }

                    return;
                }
                else
                {
                    Debug.Log("Beginning authentication session.");

                    currentAuthUnits.Add(u);
                }
            }
        }
    }
 public RolesService(AuthUnit unit, ICacheProvider cacheProvider) : base(unit)
 {
     _cacheProvider = cacheProvider;
 }