mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-18 23:38:16 +08:00
Renamed ScopeName to ApiName, ScopeSecret to ApiSecret, and
AdditionalScopes to Allowed Scoped in order to be more consistent with Identity Server naming conventions.
This commit is contained in:
@ -29,20 +29,20 @@ namespace Ocelot.UnitTests.Configuration
|
||||
{
|
||||
Provider = "Geoff",
|
||||
ProviderRootUrl = "http://www.bbc.co.uk/",
|
||||
ScopeName = "Laura",
|
||||
ApiName = "Laura",
|
||||
RequireHttps = true,
|
||||
AdditionalScopes = new List<string> {"cheese"},
|
||||
ScopeSecret = "secret"
|
||||
AllowedScopes = new List<string> {"cheese"},
|
||||
ApiSecret = "secret"
|
||||
}
|
||||
};
|
||||
|
||||
var expected = new AuthenticationOptionsBuilder()
|
||||
.WithProvider(fileReRoute.AuthenticationOptions?.Provider)
|
||||
.WithProviderRootUrl(fileReRoute.AuthenticationOptions?.ProviderRootUrl)
|
||||
.WithScopeName(fileReRoute.AuthenticationOptions?.ScopeName)
|
||||
.WithApiName(fileReRoute.AuthenticationOptions?.ApiName)
|
||||
.WithRequireHttps(fileReRoute.AuthenticationOptions.RequireHttps)
|
||||
.WithAdditionalScopes(fileReRoute.AuthenticationOptions?.AdditionalScopes)
|
||||
.WithScopeSecret(fileReRoute.AuthenticationOptions?.ScopeSecret)
|
||||
.WithAllowedScopes(fileReRoute.AuthenticationOptions?.AllowedScopes)
|
||||
.WithApiSecret(fileReRoute.AuthenticationOptions?.ApiSecret)
|
||||
.Build();
|
||||
|
||||
this.Given(x => x.GivenTheFollowing(fileReRoute))
|
||||
@ -63,12 +63,12 @@ namespace Ocelot.UnitTests.Configuration
|
||||
|
||||
private void ThenTheFollowingIsReturned(AuthenticationOptions expected)
|
||||
{
|
||||
_result.AdditionalScopes.ShouldBe(expected.AdditionalScopes);
|
||||
_result.AllowedScopes.ShouldBe(expected.AllowedScopes);
|
||||
_result.Provider.ShouldBe(expected.Provider);
|
||||
_result.ProviderRootUrl.ShouldBe(expected.ProviderRootUrl);
|
||||
_result.RequireHttps.ShouldBe(expected.RequireHttps);
|
||||
_result.ScopeName.ShouldBe(expected.ScopeName);
|
||||
_result.ScopeSecret.ShouldBe(expected.ScopeSecret);
|
||||
_result.ApiName.ShouldBe(expected.ApiName);
|
||||
_result.ApiSecret.ShouldBe(expected.ApiSecret);
|
||||
}
|
||||
}
|
||||
}
|
@ -403,9 +403,9 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.WithProvider("IdentityServer")
|
||||
.WithProviderRootUrl("http://localhost:51888")
|
||||
.WithRequireHttps(false)
|
||||
.WithScopeSecret("secret")
|
||||
.WithScopeName("api")
|
||||
.WithAdditionalScopes(new List<string>())
|
||||
.WithApiSecret("secret")
|
||||
.WithApiName("api")
|
||||
.WithAllowedScopes(new List<string>())
|
||||
.Build();
|
||||
|
||||
var expected = new List<ReRoute>
|
||||
@ -434,12 +434,12 @@ namespace Ocelot.UnitTests.Configuration
|
||||
ReRouteIsCaseSensitive = true,
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
AllowedScopes= new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
ProviderRootUrl = "http://localhost:51888",
|
||||
RequireHttps = false,
|
||||
ScopeName = "api",
|
||||
ScopeSecret = "secret"
|
||||
ApiName= "api",
|
||||
ApiSecret = "secret"
|
||||
},
|
||||
AddHeadersToRequest =
|
||||
{
|
||||
@ -471,9 +471,9 @@ namespace Ocelot.UnitTests.Configuration
|
||||
.WithProvider("IdentityServer")
|
||||
.WithProviderRootUrl("http://localhost:51888")
|
||||
.WithRequireHttps(false)
|
||||
.WithScopeSecret("secret")
|
||||
.WithScopeName("api")
|
||||
.WithAdditionalScopes(new List<string>())
|
||||
.WithApiSecret("secret")
|
||||
.WithApiName("api")
|
||||
.WithAllowedScopes(new List<string>())
|
||||
.Build();
|
||||
|
||||
var expected = new List<ReRoute>
|
||||
@ -498,12 +498,12 @@ namespace Ocelot.UnitTests.Configuration
|
||||
ReRouteIsCaseSensitive = true,
|
||||
AuthenticationOptions = new FileAuthenticationOptions
|
||||
{
|
||||
AdditionalScopes = new List<string>(),
|
||||
AllowedScopes = new List<string>(),
|
||||
Provider = "IdentityServer",
|
||||
ProviderRootUrl = "http://localhost:51888",
|
||||
RequireHttps = false,
|
||||
ScopeName = "api",
|
||||
ScopeSecret = "secret"
|
||||
ApiName= "api",
|
||||
ApiSecret = "secret"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -592,12 +592,12 @@ namespace Ocelot.UnitTests.Configuration
|
||||
var result = _config.Data.ReRoutes[i].AuthenticationOptions;
|
||||
var expected = expectedReRoutes[i].AuthenticationOptions;
|
||||
|
||||
result.AdditionalScopes.ShouldBe(expected.AdditionalScopes);
|
||||
result.AllowedScopes.ShouldBe(expected.AllowedScopes);
|
||||
result.Provider.ShouldBe(expected.Provider);
|
||||
result.ProviderRootUrl.ShouldBe(expected.ProviderRootUrl);
|
||||
result.RequireHttps.ShouldBe(expected.RequireHttps);
|
||||
result.ScopeName.ShouldBe(expected.ScopeName);
|
||||
result.ScopeSecret.ShouldBe(expected.ScopeSecret);
|
||||
result.ApiName.ShouldBe(expected.ApiName);
|
||||
result.ApiSecret.ShouldBe(expected.ApiSecret);
|
||||
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user