Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ public void ShouldLoadSettingsFromConfiguredDataStore()

// Assert
Assert.NotNull(loadedEnvironment);
// 5 built-in + 2 user-defined
Assert.Equal(7, settings.Environments.Count());
// 6 built-in + 2 user-defined
Assert.Equal(8, settings.Environments.Count());
Assert.Equal("https://login.MyNewCloud.com", loadedEnvironment.AzureADEndpoint);
Assert.Equal("https://graph.MyNewCloud.com", loadedEnvironment.GraphEndpoint);
Assert.Equal(GraphEnvironmentConstants.EnvironmentType.UserDefined, loadedEnvironment.Type);
Expand Down Expand Up @@ -155,8 +155,8 @@ public void ShouldRemoveSettingsFromConfiguredDataStore()

// Assert
Assert.NotEmpty(settingsContent);
// 5 built-in + 1 user-defined
Assert.Equal(6, settings.Environments.Count());
// 6 built-in + 1 user-defined
Assert.Equal(7, settings.Environments.Count());

GraphSession.Reset();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ public async Task ShouldUseGlobalCloudWhenEnvironmentIsNotSet()
}

[Fact]
public async Task ShouldUseGermanyCloudWhenEnvironmentIsSetToGermany()
public async Task ShouldUseDelosCloudWhenEnvironmentIsSetToDelos()
{
GraphSession.Initialize(() => new GraphSession());

// Arrange
GraphEnvironment germanyEnvironment = GraphEnvironment.BuiltInEnvironments[GraphEnvironmentConstants.EnvironmentName.Germany];
GraphSession.Instance.Environment = germanyEnvironment;
GraphEnvironment delosEnvironment = GraphEnvironment.BuiltInEnvironments[GraphEnvironmentConstants.EnvironmentName.DelosCloud];
GraphSession.Instance.Environment = delosEnvironment;
Uri requestUrl = new Uri($"https://graph.microsoft.com/beta/users?{topParam}&{selectParam}");
var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, requestUrl);

Expand All @@ -80,7 +80,7 @@ public async Task ShouldUseGermanyCloudWhenEnvironmentIsSetToGermany()

// Assert
Assert.Equal(requestUrl.Scheme, response.RequestMessage.RequestUri.Scheme);
Assert.Equal("graph.microsoft.de", response.RequestMessage.RequestUri.Host);
Assert.Equal("graph.svc.sovcloud.de", response.RequestMessage.RequestUri.Host);
Assert.Contains(topParam, sentRequestQuery);
Assert.Contains(selectParam, sentRequestQuery);
Assert.Equal(2, sentRequestQuery.Split('&').Length);
Expand Down
43 changes: 29 additions & 14 deletions src/Authentication/Authentication/GraphEnvironmentConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,19 @@ public static class EnvironmentName
public const string USGovDoD = "USGovDoD";

/// <summary>
/// The graph national cloud for Germany.
/// The graph national cloud for China.
/// </summary>
public const string Germany = "Germany";
public const string China = "China";

/// <summary>
/// The graph national cloud for China.
/// The French sovereign cloud operated by Bleu.
/// </summary>
public const string China = "China";
public const string BleuCloud = "BleuCloud";

/// <summary>
/// The German sovereign cloud operated by Delos.
/// </summary>
public const string DelosCloud = "DelosCloud";
}

/// <summary>
Expand Down Expand Up @@ -84,16 +89,6 @@ public static class EnvironmentType
GraphEndpoint = "https://dod-graph.microsoft.us"
}
},
// Germany national cloud endpoints.
{
EnvironmentName.Germany, new GraphEnvironment
{
Name = EnvironmentName.Germany,
Type = EnvironmentType.BuiltIn,
AzureADEndpoint = "https://login.microsoftonline.de",
GraphEndpoint = "https://graph.microsoft.de"
}
},
// China national cloud endpoints.
{
EnvironmentName.China, new GraphEnvironment
Expand All @@ -103,6 +98,26 @@ public static class EnvironmentType
AzureADEndpoint = "https://login.chinacloudapi.cn",
GraphEndpoint = "https://microsoftgraph.chinacloudapi.cn"
}
},
// French sovereign cloud endpoints.
{
EnvironmentName.BleuCloud, new GraphEnvironment
{
Name = EnvironmentName.BleuCloud,
Type = EnvironmentType.BuiltIn,
AzureADEndpoint = "https://login.sovcloud-identity.fr",
GraphEndpoint = "https://graph.svc.sovcloud.fr"
}
},
// German sovereign cloud endpoints.
{
EnvironmentName.DelosCloud, new GraphEnvironment
{
Name = EnvironmentName.DelosCloud,
Type = EnvironmentType.BuiltIn,
AzureADEndpoint = "https://login.sovcloud-identity.de",
GraphEndpoint = "https://graph.svc.sovcloud.de"
}
}
};
}
Expand Down
Loading