Files
raven d906cd8d64 Tons of fixes
Added movement updates
Updated how entities are checked
Events sending between packet service all the way to the logic service
2025-07-02 15:37:10 -04:00
..
2025-07-02 15:37:10 -04:00

Authentication Service

The Authentication Service is responsible for user authentication, session validation, and account management in the MMORPG server architecture.

Overview

The Authentication Service provides gRPC endpoints for:

  • User login and logout
  • Session validation and refresh

It communicates with the external database service to verify user credentials and manage sessions.

Architecture

The service is built using the following components:

  • gRPC Server: Exposes authentication endpoints
  • Database Client: Communicates with the database service for user data
  • Session Client: Manages user sessions
  • Password Hashing: Securely handles password verification

Note

: User registration and password reset functionality are handled by an external system.

Service Endpoints

The Authentication Service exposes the following gRPC endpoints:

Login

Authenticates a user and creates a new session.

rpc Login(LoginRequest) returns (LoginResponse);

Logout

Terminates a user session.

rpc Logout(LogoutRequest) returns (Empty);

ValidateToken

Validates a JWT token.

rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);

ValidateSession

Validates a session ID.

rpc ValidateSession(ValidateSessionRequest) returns (ValidateSessionResponse);

RefreshSession

Refreshes an existing session.

rpc RefreshSession(ValidateSessionRequest) returns (RefreshSessionResponse);

Configuration

The service can be configured using environment variables:

  • LISTEN_ADDR: The address to listen on (default: "0.0.0.0")
  • SERVICE_PORT: The port to listen on (default: "50051")
  • LOG_LEVEL: Logging level (default: "info")

Running the Service

Local Development

cargo run

Docker

docker build -t auth-service .
docker run -p 50051:50051 auth-service

Integration with External Systems

The Authentication Service integrates with:

  • Database Service: For user data storage and retrieval
  • Session Service: For session management
  • External Auth System: The service is designed to work with an external authentication system (better-auth) that manages the database schema and user accounts