Audacity 3.2.0
Functions | Variables
cloud::audiocom::anonymous_namespace{OAuthService.cpp} Namespace Reference

Functions

void WriteCommonFields (rapidjson::Document &document, std::string_view grantType, std::string_view scope)
 
bool IsPrefixed (std::string_view hay, std::string_view prefix)
 

Variables

StringSetting refreshToken { L"/cloud/audiocom/refreshToken", "" }
 
const std::string_view uriPrefix = "audacity://link"
 
const std::string_view usernamePrefix = "username="
 
const std::string_view passwordPrefix = "password="
 
const std::string_view tokenPrefix = "token="
 
const std::string_view authorizationCodePrefix = "authorization_code="
 

Function Documentation

◆ IsPrefixed()

bool cloud::audiocom::anonymous_namespace{OAuthService.cpp}::IsPrefixed ( std::string_view  hay,
std::string_view  prefix 
)

Definition at line 72 of file OAuthService.cpp.

73{
74 if (hay.length() < prefix.length())
75 return false;
76
77 return std::mismatch(
78 prefix.begin(), prefix.end(), hay.begin(),
79 [](auto a, auto b) { return a == std::tolower(b); })
80 .first == prefix.end();
81}

Referenced by cloud::audiocom::OAuthService::HandleLinkURI().

Here is the caller graph for this function:

◆ WriteCommonFields()

void cloud::audiocom::anonymous_namespace{OAuthService.cpp}::WriteCommonFields ( rapidjson::Document &  document,
std::string_view  grantType,
std::string_view  scope 
)

Definition at line 46 of file OAuthService.cpp.

48{
49 using namespace rapidjson;
50
51 document.AddMember(
52 "grant_type", StringRef(grantType.data(), grantType.size()),
53 document.GetAllocator());
54
55 const auto clientID = GetServiceConfig().GetOAuthClientID();
56 const auto clientSecret = GetServiceConfig().GetOAuthClientSecret();
57
58 document.AddMember(
59 "client_id",
60 Value(clientID.data(), clientID.size(), document.GetAllocator()),
61 document.GetAllocator());
62
63 document.AddMember(
64 "client_secret",
65 Value(clientSecret.data(), clientSecret.size(), document.GetAllocator()),
66 document.GetAllocator());
67
68 document.AddMember(
69 "scope", StringRef(scope.data(), scope.size()), document.GetAllocator());
70}
std::string GetOAuthClientID() const
OAuth2 client ID.
std::string GetOAuthClientSecret() const
OAuth2 client secret.
static CommandContext::TargetFactory::SubstituteInUnique< InteractiveOutputTargets > scope
const ServiceConfig & GetServiceConfig()
Returns the instance of the ServiceConfig.

References cloud::audiocom::ServiceConfig::GetOAuthClientID(), cloud::audiocom::ServiceConfig::GetOAuthClientSecret(), cloud::audiocom::GetServiceConfig(), and anonymous_namespace{wxCommandTargets.cpp}::scope.

Referenced by cloud::audiocom::OAuthService::AuthoriseCode(), cloud::audiocom::OAuthService::AuthorisePassword(), and cloud::audiocom::OAuthService::AuthoriseRefreshToken().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ authorizationCodePrefix

const std::string_view cloud::audiocom::anonymous_namespace{OAuthService.cpp}::authorizationCodePrefix = "authorization_code="

Definition at line 44 of file OAuthService.cpp.

Referenced by cloud::audiocom::OAuthService::HandleLinkURI().

◆ passwordPrefix

const std::string_view cloud::audiocom::anonymous_namespace{OAuthService.cpp}::passwordPrefix = "password="

Definition at line 42 of file OAuthService.cpp.

Referenced by cloud::audiocom::OAuthService::HandleLinkURI().

◆ refreshToken

StringSetting cloud::audiocom::anonymous_namespace{OAuthService.cpp}::refreshToken { L"/cloud/audiocom/refreshToken", "" }

◆ tokenPrefix

const std::string_view cloud::audiocom::anonymous_namespace{OAuthService.cpp}::tokenPrefix = "token="

Definition at line 43 of file OAuthService.cpp.

Referenced by cloud::audiocom::OAuthService::HandleLinkURI().

◆ uriPrefix

const std::string_view cloud::audiocom::anonymous_namespace{OAuthService.cpp}::uriPrefix = "audacity://link"

Definition at line 40 of file OAuthService.cpp.

Referenced by cloud::audiocom::OAuthService::HandleLinkURI().

◆ usernamePrefix

const std::string_view cloud::audiocom::anonymous_namespace{OAuthService.cpp}::usernamePrefix = "username="

Definition at line 41 of file OAuthService.cpp.

Referenced by cloud::audiocom::OAuthService::HandleLinkURI().