14
14
using Ocelot . UnitTests . Requester ;
15
15
using Ocelot . Values ;
16
16
using System . Security . Claims ;
17
- using System . Text . Encodings . Web ;
17
+ using System . Text . Encodings . Web ;
18
18
19
19
namespace Ocelot . UnitTests . Configuration . Validation
20
20
{
@@ -461,6 +461,7 @@ public void Configuration_is_invalid_with_invalid_authentication_provider()
461
461
. When ( x => x . WhenIValidateTheConfiguration ( ) )
462
462
. Then ( x => x . ThenTheResultIsNotValid ( ) )
463
463
. And ( x => x . ThenTheErrorMessageAtPositionIs ( 0 , "Authentication Options AuthenticationProviderKey:'Test',AuthenticationProviderKeys:['Test #1','Test #2'],AllowedScopes:[] is unsupported authentication provider" ) )
464
+ . And ( x => x . ThenTheErrorMessageAtPositionIs ( 0 , "Authentication Options AuthenticationProviderKey:Test,AllowedScopes:[],RequiredRole:[],ScopeKey:[],RoleKey:[],PolicyName:[] is unsupported authentication provider" ) )
464
465
. BDDfy ( ) ;
465
466
}
466
467
@@ -630,7 +631,7 @@ public void Configuration_is_invalid_when_not_using_service_discovery_and_host(s
630
631
[ InlineData ( Empty , true ) ]
631
632
[ InlineData ( "Test" , false ) ]
632
633
public void HaveServiceDiscoveryProviderRegistered_RouteServiceName_Validated ( string serviceName , bool valid )
633
- {
634
+ {
634
635
// Arrange
635
636
var route = GivenDefaultRoute ( ) ;
636
637
route . ServiceName = serviceName ;
@@ -747,7 +748,7 @@ public void Configuration_is_not_valid_when_host_and_port_is_empty()
747
748
. And ( x => x . ThenTheErrorMessageAtPositionIs ( 0 , "When not using service discovery Host must be set on DownstreamHostAndPorts if you are not using Route.Host or Ocelot cannot find your service!" ) )
748
749
. BDDfy ( ) ;
749
750
}
750
-
751
+
751
752
[ Theory ]
752
753
[ Trait ( "PR" , "1927" ) ]
753
754
[ InlineData ( "/foo/{bar}/foo" , "/yahoo/foo/{bar}" ) ] // valid
@@ -842,10 +843,10 @@ private FileConfiguration GivenAConfiguration(params FileRoute[] routes)
842
843
config . Routes . AddRange ( routes ) ;
843
844
_fileConfiguration = config ;
844
845
return config ;
845
- }
846
+ }
846
847
847
848
private static FileServiceDiscoveryProvider GivenDefaultServiceDiscoveryProvider ( ) => new ( )
848
- {
849
+ {
849
850
Scheme = Uri . UriSchemeHttps ,
850
851
Host = "localhost" ,
851
852
Type = "ServiceFabric" ,
@@ -875,8 +876,8 @@ private void ThenTheErrorIs<T>()
875
876
private void ThenTheErrorMessageAtPositionIs ( int index , string expected )
876
877
{
877
878
_result . Data . Errors [ index ] . Message . ShouldBe ( expected ) ;
878
- }
879
-
879
+ }
880
+
880
881
private void ThenThereAreErrors ( bool isError )
881
882
{
882
883
_result . Data . IsError . ShouldBe ( isError ) ;
@@ -924,7 +925,7 @@ private class FakeServiceDiscoveryProvider : IServiceDiscoveryProvider
924
925
private class TestOptions : AuthenticationSchemeOptions { }
925
926
926
927
private class TestHandler : AuthenticationHandler < TestOptions >
927
- {
928
+ {
928
929
// https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/8.0/isystemclock-obsolete
929
930
// .NET 8.0: TimeProvider is now a settable property on the Options classes for the authentication and identity components.
930
931
// It can be set directly or by registering a provider in the dependency injection container.
@@ -935,9 +936,9 @@ public TestHandler(IOptionsMonitor<TestOptions> options, ILoggerFactory logger,
935
936
#else
936
937
public TestHandler ( IOptionsMonitor < TestOptions > options , ILoggerFactory logger , UrlEncoder encoder , ISystemClock clock ) : base ( options , logger , encoder , clock )
937
938
{
938
- }
939
+ }
939
940
#endif
940
-
941
+
941
942
protected override Task < AuthenticateResult > HandleAuthenticateAsync ( )
942
943
{
943
944
var principal = new ClaimsPrincipal ( ) ;
0 commit comments