nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
nanommo::Tokens Class Reference

#include <tokens.h>

Public Member Functions

 Tokens (Redis &redis)
absl::StatusOr< std::string > Issue (uint32_t player_id)
absl::StatusOr< uint32_t > Redeem (const std::string &token, SpanContext *issuer=nullptr)
absl::StatusOr< std::string > Open (uint32_t account_id)
absl::StatusOr< uint32_t > AccountOf (const std::string &session)

Static Public Attributes

static constexpr std::chrono::seconds kLifetime {30}
static constexpr std::chrono::minutes kSessionLifetime {30}
 How long a login's session lasts after its last request.

Detailed Description

Definition at line 18 of file tokens.h.

Constructor & Destructor Documentation

◆ Tokens()

nanommo::Tokens::Tokens ( Redis & redis)
explicit

Definition at line 32 of file tokens.cc.

Member Function Documentation

◆ AccountOf()

absl::StatusOr< uint32_t > nanommo::Tokens::AccountOf ( const std::string & session)

The account the session is for, which keeps it going for another kSessionLifetime, or a NotFound error once it's run out.

Definition at line 87 of file tokens.cc.

◆ Issue()

absl::StatusOr< std::string > nanommo::Tokens::Issue ( uint32_t player_id)

A token to enter a world with, once, as the player with the id: a character, from the login server, or one moving to another instance. Issued for a traced request, its record carries on the trace.

Definition at line 36 of file tokens.cc.

◆ Open()

absl::StatusOr< std::string > nanommo::Tokens::Open ( uint32_t account_id)

A session for the account, which its next requests to the login server go with in place of the name and the password.

Definition at line 76 of file tokens.cc.

◆ Redeem()

absl::StatusOr< uint32_t > nanommo::Tokens::Redeem ( const std::string & token,
SpanContext * issuer = nullptr )

Returns a NotFound error for a token that's unknown, used or expired. With an issuer, it's given the span that issued the token, which the request redeeming it carries on from, or no span, when that wasn't traced.

Definition at line 54 of file tokens.cc.

Member Data Documentation

◆ kLifetime

std::chrono::seconds nanommo::Tokens::kLifetime {30}
staticconstexpr

Definition at line 20 of file tokens.h.

◆ kSessionLifetime

std::chrono::minutes nanommo::Tokens::kSessionLifetime {30}
staticconstexpr

How long a login's session lasts after its last request.

Definition at line 22 of file tokens.h.


The documentation for this class was generated from the following files: