R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
SessionManager.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by hugo on 06/12/2025
4** File description:
5** SessionManager.hpp
6*/
7
8#pragma once
9
10#include <memory>
11#include <unordered_map>
14
15namespace server {
16
22 public:
24 explicit SessionManager(std::shared_ptr<AuthService> authService);
25 ~SessionManager() override = default;
26
27 std::shared_ptr<Session> createSession(const std::string &id) override;
28 std::shared_ptr<Session> getSession(const std::string &id) override;
29 void removeSession(const std::string &id) override;
30
37 std::string authenticateAndCreateSession(const std::string &username, const std::string &password);
38
43 std::shared_ptr<AuthService> getAuthService() { return _authService; }
44
45 private:
46 std::unordered_map<std::string, std::shared_ptr<Session>> _sessions;
47 std::shared_ptr<AuthService> _authService;
48 };
49
50} // namespace server
Manages active player sessions with authentication support.
std::shared_ptr< AuthService > _authService
std::shared_ptr< Session > createSession(const std::string &id) override
Create a new session.
std::string authenticateAndCreateSession(const std::string &username, const std::string &password)
Authenticate and create a session.
~SessionManager() override=default
std::unordered_map< std::string, std::shared_ptr< Session > > _sessions
std::shared_ptr< Session > getSession(const std::string &id) override
Get session by ID.
void removeSession(const std::string &id) override
Remove session by ID.
std::shared_ptr< AuthService > getAuthService()
Get the auth service.