mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-23 00:52:51 +08:00
fixing tests
This commit is contained in:
parent
20f6ebac2f
commit
a7eeadb4c6
@ -19,7 +19,7 @@ namespace Ocelot.Authentication.Handler.Creator
|
||||
{
|
||||
var builder = app.New();
|
||||
|
||||
var authenticationConfig = authOptions.Config as IdentityServerConfig;
|
||||
var authenticationConfig = authOptions.Config;
|
||||
|
||||
builder.UseIdentityServerAuthentication(new IdentityServerAuthenticationOptions
|
||||
{
|
||||
|
@ -2,9 +2,11 @@
|
||||
|
||||
namespace Ocelot.Configuration
|
||||
{
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class AuthenticationOptions
|
||||
{
|
||||
public AuthenticationOptions(string provider, List<string> allowedScopes, IAuthenticationConfig config)
|
||||
public AuthenticationOptions(string provider, List<string> allowedScopes, IdentityServerConfig config)
|
||||
{
|
||||
Provider = provider;
|
||||
AllowedScopes = allowedScopes;
|
||||
@ -15,15 +17,10 @@ namespace Ocelot.Configuration
|
||||
|
||||
public List<string> AllowedScopes { get; private set; }
|
||||
|
||||
public IAuthenticationConfig Config { get; }
|
||||
public IdentityServerConfig Config { get; private set; }
|
||||
}
|
||||
|
||||
|
||||
public interface IAuthenticationConfig
|
||||
{
|
||||
}
|
||||
|
||||
public class IdentityServerConfig : IAuthenticationConfig
|
||||
public class IdentityServerConfig
|
||||
{
|
||||
public IdentityServerConfig(string providerRootUrl, string apiName, bool requireHttps, string apiSecret)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace Ocelot.Configuration.Builder
|
||||
|
||||
private List<string> _allowedScopes;
|
||||
|
||||
private IAuthenticationConfig _config;
|
||||
private IdentityServerConfig _identityServerConfig;
|
||||
|
||||
public AuthenticationOptionsBuilder WithProvider(string provider)
|
||||
{
|
||||
@ -23,15 +23,15 @@ namespace Ocelot.Configuration.Builder
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuthenticationOptionsBuilder WithConfiguration(IAuthenticationConfig config)
|
||||
public AuthenticationOptionsBuilder WithIdntityServerConfigConfiguration(IdentityServerConfig config)
|
||||
{
|
||||
_config = config;
|
||||
_identityServerConfig = config;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuthenticationOptions Build()
|
||||
{
|
||||
return new AuthenticationOptions(_provider, _allowedScopes, _config);
|
||||
return new AuthenticationOptions(_provider, _allowedScopes, _identityServerConfig);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,19 +7,19 @@ namespace Ocelot.Configuration.Creator
|
||||
{
|
||||
public AuthenticationOptions Create(FileReRoute fileReRoute)
|
||||
{
|
||||
var authenticationConfig = new AuthenticationConfigCreator().Create(fileReRoute.AuthenticationOptions);
|
||||
var authenticationConfig = new IdentityServerConfigCreator().Create(fileReRoute.AuthenticationOptions);
|
||||
|
||||
return new AuthenticationOptionsBuilder()
|
||||
.WithProvider(fileReRoute.AuthenticationOptions?.Provider)
|
||||
.WithAllowedScopes(fileReRoute.AuthenticationOptions?.AllowedScopes)
|
||||
.WithConfiguration(authenticationConfig)
|
||||
.WithIdntityServerConfigConfiguration(authenticationConfig)
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
public class AuthenticationConfigCreator
|
||||
public class IdentityServerConfigCreator
|
||||
{
|
||||
public IAuthenticationConfig Create(FileAuthenticationOptions authenticationOptions)
|
||||
public IdentityServerConfig Create(FileAuthenticationOptions authenticationOptions)
|
||||
{
|
||||
return new IdentityServerConfigBuilder()
|
||||
.WithApiName(authenticationOptions.IdentityServerConfig?.ApiName)
|
||||
|
@ -29,7 +29,6 @@ namespace Ocelot.AcceptanceTests
|
||||
_steps = new Steps();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
public void should_return_response_200_with_simple_url()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user