-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathAuthTokensController.cpp
More file actions
81 lines (68 loc) · 2.12 KB
/
AuthTokensController.cpp
File metadata and controls
81 lines (68 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
#include "pal/PAL.hpp"
#include "AuthTokensController.hpp"
#include "ILogManager.hpp"
#include "utils/Utils.hpp"
namespace MAT_NS_BEGIN {
MATSDK_LOG_INST_COMPONENT_CLASS(AuthTokensController, "EventsSDK.AuthTokensController", "Events telemetry client - AuthTokensController class")
AuthTokensController::AuthTokensController()
:m_IsStrictModeEnabled(false)
{
LOG_TRACE("New AuthTokensController instance");
}
AuthTokensController::~AuthTokensController()
{
LOG_TRACE("destructor");
}
status_t AuthTokensController::SetTicketToken(TicketType type, char const* tokenValue)
{
if (nullptr != tokenValue)
{
if (type == TicketType::TicketType_MSA_Device ||
type == TicketType::TicketType_AAD ||
type == TicketType::TicketType_XAuth_Device ||
type == TicketType::TicketType_AAD_Device)
{
m_deviceTokens[type] = std::string(tokenValue);
}
else
{
m_tickets.push_back(TICKETS_PREPEND_STRING + std::to_string(type));
m_userTokens[type] = std::string(tokenValue);
}
return STATUS_SUCCESS;
}
return STATUS_EFAIL;
}
status_t AuthTokensController::Clear()
{
m_deviceTokens.clear();
m_userTokens.clear();
m_tickets.clear();
return STATUS_SUCCESS;
}
status_t AuthTokensController::SetStrictMode(bool value)
{
m_IsStrictModeEnabled = value;
return STATUS_EFAIL;
}
bool AuthTokensController::GetStrictMode()
{
return m_IsStrictModeEnabled;
}
std::vector<std::string>& AuthTokensController::GetTickets()
{
return m_tickets;
}
std::map<TicketType, std::string>& AuthTokensController::GetDeviceTokens()
{
return m_deviceTokens;
}
std::map<TicketType, std::string>& AuthTokensController::GetUserTokens()
{
return m_userTokens;
}
} MAT_NS_END