This commit is contained in:
Ashley Rogers 2024-04-26 15:31:20 -04:00
parent 9146f98605
commit 22124e3e42
3 changed files with 13 additions and 13 deletions

View File

@ -6,7 +6,7 @@
namespace CesiumIonClient {
/**
* @brief An enumeration representing the values of {@link ApplicationData::applicationMode}.
* @brief An enumeration representing the values of {@link ApplicationData::authenticationMode}.
*/
enum AuthenticationMode {
/**
@ -34,9 +34,9 @@ enum AuthenticationMode {
*/
struct ApplicationData {
/**
* The authentication mode that the Ion server is running in.
* The authentication mode that the ion server is running in.
*/
AuthenticationMode applicationMode;
AuthenticationMode authenticationMode;
/**
* The type of store used by this ion server to hold files.
@ -50,7 +50,7 @@ struct ApplicationData {
std::string attribution;
bool needsOauthAuthentication() const {
return this->applicationMode != AuthenticationMode::SingleUser;
return this->authenticationMode != AuthenticationMode::SingleUser;
}
};

View File

@ -308,7 +308,7 @@ bool parseJsonObject(const IAssetResponse* pResponse, rapidjson::Document& d) {
CesiumAsync::Future<Response<Profile>> Connection::me() const {
// /v1/me endpoint doesn't exist when ion is running in single user mode
if (this->_appData.applicationMode == AuthenticationMode::SingleUser) {
if (this->_appData.authenticationMode == AuthenticationMode::SingleUser) {
Profile profile;
profile.id = 0;
profile.username = "ion-user";
@ -427,14 +427,14 @@ CesiumIonClient::Connection::appData(
// There's a lot more properties available on the /appData endpoint, but
// we don't need them so we're ignoring them for now.
ApplicationData result;
std::string applicationMode =
std::string authenticationMode =
JsonHelpers::getStringOrDefault(d, "applicationMode", "cesium-ion");
if (applicationMode == "single-user") {
result.applicationMode = AuthenticationMode::SingleUser;
} else if (applicationMode == "saml") {
result.applicationMode = AuthenticationMode::Saml;
if (authenticationMode == "single-user") {
result.authenticationMode = AuthenticationMode::SingleUser;
} else if (authenticationMode == "saml") {
result.authenticationMode = AuthenticationMode::Saml;
} else {
result.applicationMode = AuthenticationMode::CesiumIon;
result.authenticationMode = AuthenticationMode::CesiumIon;
}
result.dataStoreType =
JsonHelpers::getStringOrDefault(d, "dataStoreType", "S3");
@ -727,7 +727,7 @@ TokenList tokenListFromJson(const rapidjson::Value& json) {
Future<Response<TokenList>>
Connection::tokens(const ListTokensOptions& options) const {
if (this->_appData.applicationMode == AuthenticationMode::SingleUser) {
if (this->_appData.authenticationMode == AuthenticationMode::SingleUser) {
TokenList emptyList = TokenList{};
return this->_asyncSystem.createResolvedFuture<Response<TokenList>>(
Response{std::move(emptyList), 200, "", ""});

View File

@ -82,7 +82,7 @@ TEST_CASE("CesiumIonClient::Connection on single-user mode") {
std::map<std::string, std::shared_ptr<SimpleAssetRequest>>());
ApplicationData data;
data.applicationMode = AuthenticationMode::SingleUser;
data.authenticationMode = AuthenticationMode::SingleUser;
AsyncSystem asyncSystem(std::make_shared<SimpleTaskProcessor>());
Connection connection(