示例#1
0
        public SimpleAuthenticationAzure(ISettings appSettings, ILoggingConsole loggingConsole)
        {
            this.loggingConsole = loggingConsole;
            this.settings       = appSettings;

            this.authConfig = settings.GetAuthenticationConfig();
        }
示例#2
0
        public void should_create_with_authentication_properties(string provider, IAuthenticationConfig config, FileConfiguration fileConfig)
        {
            var reRouteOptions = new ReRouteOptionsBuilder()
                                 .WithIsAuthenticated(true)
                                 .Build();

            var authenticationOptions = new AuthenticationOptionsBuilder()
                                        .WithProvider(provider)
                                        .WithAllowedScopes(new List <string>())
                                        .WithConfig(config)
                                        .Build();

            var expected = new List <ReRoute>
            {
                new ReRouteBuilder()
                .WithDownstreamPathTemplate("/products/{productId}")
                .WithUpstreamPathTemplate("/api/products/{productId}")
                .WithUpstreamHttpMethod(new List <string> {
                    "Get"
                })
                .WithAuthenticationOptions(authenticationOptions)
                .Build()
            };

            this.Given(x => x.GivenTheConfigIs(fileConfig))
            .And(x => x.GivenTheConfigIsValid())
            .And(x => x.GivenTheFollowingOptionsAreReturned(reRouteOptions))
            .And(x => x.GivenTheAuthOptionsCreatorReturns(authenticationOptions))
            .And(x => x.GivenTheLoadBalancerFactoryReturns())
            .When(x => x.WhenICreateTheConfig())
            .Then(x => x.ThenTheReRoutesAre(expected))
            .And(x => x.ThenTheAuthenticationOptionsAre(provider, expected))
            .And(x => x.ThenTheAuthOptionsCreatorIsCalledCorrectly())
            .BDDfy();
        }
示例#3
0
 public Settings(IAuthenticationConfig authConfig, ILoggingConsole loggingConsole)
 {
     this.authConfig     = authConfig;
     this.loggingConsole = loggingConsole;
     this.appSettings    = "appsettings.json";
 }
示例#4
0
 public static string GetAadAuthority(this IAuthenticationConfig authenticationConfig)
 {
     return(authenticationConfig.AadAuthority + authenticationConfig.Tenant);
 }
示例#5
0
 public AuthenticationOptions(string provider, List <string> allowedScopes, IAuthenticationConfig config)
 {
     Provider      = provider;
     AllowedScopes = allowedScopes;
     Config        = config;
 }
示例#6
0
 public AuthenticationOptionsBuilder WithConfig(IAuthenticationConfig config)
 {
     _identityServerConfig = config;
     return(this);
 }