mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-12-24 19:45:49 +08:00
Added tests for identity server reference tokens, general refactoring and come config validation
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace Ocelot.Library.Infrastructure.Builder
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ocelot.Library.Infrastructure.Builder
|
||||
{
|
||||
using Configuration;
|
||||
|
||||
@@ -10,38 +12,84 @@
|
||||
private string _upstreamHttpMethod;
|
||||
private bool _isAuthenticated;
|
||||
private string _authenticationProvider;
|
||||
private string _authenticationProviderUrl;
|
||||
private string _scopeName;
|
||||
private List<string> _additionalScopes;
|
||||
private bool _requireHttps;
|
||||
private string _scopeSecret;
|
||||
|
||||
public void WithDownstreamTemplate(string input)
|
||||
public ReRouteBuilder()
|
||||
{
|
||||
_additionalScopes = new List<string>();
|
||||
}
|
||||
|
||||
public ReRouteBuilder WithDownstreamTemplate(string input)
|
||||
{
|
||||
_downstreamTemplate = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void WithUpstreamTemplate(string input)
|
||||
public ReRouteBuilder WithUpstreamTemplate(string input)
|
||||
{
|
||||
_upstreamTemplate = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void WithUpstreamTemplatePattern(string input)
|
||||
public ReRouteBuilder WithUpstreamTemplatePattern(string input)
|
||||
{
|
||||
_upstreamTemplatePattern = input;
|
||||
return this;
|
||||
}
|
||||
public void WithUpstreamHttpMethod(string input)
|
||||
public ReRouteBuilder WithUpstreamHttpMethod(string input)
|
||||
{
|
||||
_upstreamHttpMethod = input;
|
||||
return this;
|
||||
}
|
||||
public void WithIsAuthenticated(bool input)
|
||||
public ReRouteBuilder WithIsAuthenticated(bool input)
|
||||
{
|
||||
_isAuthenticated = input;
|
||||
return this;
|
||||
|
||||
}
|
||||
public void WithAuthenticationProvider(string input)
|
||||
public ReRouteBuilder WithAuthenticationProvider(string input)
|
||||
{
|
||||
_authenticationProvider = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReRouteBuilder WithAuthenticationProviderUrl(string input)
|
||||
{
|
||||
_authenticationProviderUrl = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReRouteBuilder WithAuthenticationProviderScopeName(string input)
|
||||
{
|
||||
_scopeName = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReRouteBuilder WithAuthenticationProviderAdditionalScopes(List<string> input)
|
||||
{
|
||||
_additionalScopes = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReRouteBuilder WithRequireHttps(bool input)
|
||||
{
|
||||
_requireHttps = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReRouteBuilder WithScopeSecret(string input)
|
||||
{
|
||||
_scopeSecret = input;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ReRoute Build()
|
||||
{
|
||||
return new ReRoute(_downstreamTemplate, _upstreamTemplate, _upstreamHttpMethod, _upstreamTemplatePattern, _isAuthenticated, _authenticationProvider);
|
||||
return new ReRoute(_downstreamTemplate, _upstreamTemplate, _upstreamHttpMethod, _upstreamTemplatePattern, _isAuthenticated, new AuthenticationOptions(_authenticationProvider, _authenticationProviderUrl, _scopeName, _requireHttps, _additionalScopes, _scopeSecret));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user