TrinityCore
Loading...
Searching...
No Matches
AuthenticationService.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_AUTHENTICATION_SERVICE_H
19#define TRINITYCORE_AUTHENTICATION_SERVICE_H
20
21#include "Service.h"
22#include "ClientBuildInfo.h"
23#include "Client/authentication_service.pb.h"
24#include "Client/api/client/v2/authentication_service.pb.h"
25
26namespace Battlenet
27{
28struct AccountInfo;
29}
30
31namespace Battlenet::Services
32{
33 namespace Shared
34 {
36 {
37 public:
38 static uint32 HandleLogon(Session* session, ClientBuild::Program::Id program, std::string_view platform,
39 std::string_view locale, uint32 applicationVersion, std::string_view deviceId);
40 static uint32 HandleVerifyAuthToken(Session* session, std::string_view authToken,
41 std::function<void(uint32)> sendResponse, std::function<void(AccountInfo const*, std::string_view)> sendLogonComplete);
42 static uint32 HandleGenerateAuthToken(Session* session, std::function<void(std::string_view)> sendResponse);
43 };
44 }
45
46 namespace V1
47 {
48 class Authentication : public Service<authentication::v1::AuthenticationService>
49 {
51
52 public:
53 Authentication(Session* session);
54
55 uint32 HandleLogon(authentication::v1::LogonRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
56 uint32 HandleVerifyWebCredentials(authentication::v1::VerifyWebCredentialsRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
57 uint32 HandleGenerateWebCredentials(authentication::v1::GenerateWebCredentialsRequest const* request, authentication::v1::GenerateWebCredentialsResponse* response, std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& continuation) override;
58
59 private:
60 uint32 HandleVerifyWebCredentials(std::string_view webCredentials, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation);
61 };
62 }
63
64 namespace V2
65 {
66 class Authentication : public Service<authentication::v2::client::AuthenticationService>
67 {
69
70 public:
71 Authentication(Session* session);
72
73 uint32 HandleLogon(authentication::v2::client::LogonRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
74 uint32 HandleVerifyAuthToken(authentication::v2::client::VerifyAuthTokenRequest const* request, NoData* response, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation) override;
75 uint32 HandleGenerateAuthToken(authentication::v2::client::GenerateAuthTokenRequest const* request, authentication::v2::client::GenerateAuthTokenResponse* response, std::function<void(ServiceBase*, uint32, google::protobuf::Message const*)>& continuation) override;
76
77 private:
78 uint32 HandleVerifyAuthToken(std::string_view authToken, std::function<void(ServiceBase*, uint32, ::google::protobuf::Message const*)>& continuation);
79 };
80 }
81}
82
83#endif // TRINITYCORE_AUTHENTICATION_SERVICE_H
uint32_t uint32
Definition Define.h:154
static uint32 HandleVerifyAuthToken(Session *session, std::string_view authToken, std::function< void(uint32)> sendResponse, std::function< void(AccountInfo const *, std::string_view)> sendLogonComplete)
static uint32 HandleLogon(Session *session, ClientBuild::Program::Id program, std::string_view platform, std::string_view locale, uint32 applicationVersion, std::string_view deviceId)
static uint32 HandleGenerateAuthToken(Session *session, std::function< void(std::string_view)> sendResponse)
Service< authentication::v1::AuthenticationService > AuthenticationService
uint32 HandleGenerateWebCredentials(authentication::v1::GenerateWebCredentialsRequest const *request, authentication::v1::GenerateWebCredentialsResponse *response, std::function< void(ServiceBase *, uint32, google::protobuf::Message const *)> &continuation) override
uint32 HandleVerifyWebCredentials(std::string_view webCredentials, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation)
uint32 HandleVerifyWebCredentials(authentication::v1::VerifyWebCredentialsRequest const *request, NoData *response, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation) override
uint32 HandleLogon(authentication::v1::LogonRequest const *request, NoData *response, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation) override
uint32 HandleVerifyAuthToken(std::string_view authToken, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation)
uint32 HandleLogon(authentication::v2::client::LogonRequest const *request, NoData *response, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation) override
uint32 HandleVerifyAuthToken(authentication::v2::client::VerifyAuthTokenRequest const *request, NoData *response, std::function< void(ServiceBase *, uint32, ::google::protobuf::Message const *)> &continuation) override
uint32 HandleGenerateAuthToken(authentication::v2::client::GenerateAuthTokenRequest const *request, authentication::v2::client::GenerateAuthTokenResponse *response, std::function< void(ServiceBase *, uint32, google::protobuf::Message const *)> &continuation) override
Service< authentication::v2::client::AuthenticationService > AuthenticationService